home *** CD-ROM | disk | FTP | other *** search
/ NeXTSTEP 3.3 (Developer)…68k, x86, SPARC, PA-RISC] / NeXTSTEP 3.3 Dev Intel.iso / usr / sybase / include4_6 / sybdb.h next >
C/C++ Source or Header  |  1993-04-22  |  131KB  |  2,835 lines

  1.  
  2. /*
  3. **      sybdb.h 77.1 11/11/91
  4. **
  5. **      Sybase DB-LIBRARY Version 4.6
  6. **      Confidential Property of Sybase, Inc.
  7. **      (c) Copyright Sybase, Inc. 1988, 1990
  8. **      All rights reserved
  9. **
  10. **
  11. ** Use, duplication, or disclosure by the Government
  12. ** is subject to restrictions as set forth in subparagraph (c) (1) (ii)
  13. ** of the Rights in Technical Data and Computer Software clause
  14. ** at DFARS 52.227-7013. Sybase, Inc. 6475 Christie Avenue, Emeryville,
  15. ** CA 94608.
  16. **
  17. */
  18.  
  19. #ifndef __sybdb__
  20. #define __sybdb__
  21.  
  22.  
  23. #if MAC
  24. #include        <Memory.h>
  25. #endif  /* MAC */
  26.  
  27. /* temporarily undef ABS since there is one in sybdbtokens.h */
  28. #ifdef  ABS
  29. #undef  ABS
  30. #endif  /* ABS */
  31. #include        <sybdbtoken.h>
  32. #ifdef  ABS
  33. #undef  ABS
  34. #endif  /* ABS */
  35. #define ABS(a)          ((a) > 0 ? (a) : -(a))
  36.  
  37. /*
  38. **  Status code for dbnextrow() and dbgetrow().
  39. **  Return of > 0 indicates ALTROW.
  40. **  FAIL is another possible return.
  41. */
  42. #define MORE_ROWS       -1
  43. #define NO_MORE_ROWS    -2
  44. #define REG_ROW         MORE_ROWS
  45. #define BUF_FULL        -3
  46.  
  47. /*
  48. ** Return code for dbreadtext().
  49. */
  50. #define NO_MORE_PARAMS  -4
  51.  
  52. /*
  53. **  Status code for dbresults(). Possible return values are
  54. **  SUCCEED, FAIL, and NO_MORE_RESULTS.
  55. */
  56. #define NO_MORE_RESULTS 2
  57.  
  58. /*
  59. **  Return code for message-handlers. Indicates whether or not the handler
  60. **  wants DB-LIBRARY to buffer the current Server message for later use
  61. **  by the program.
  62. */
  63. #define DBSAVE          1
  64. #define DBNOSAVE        0
  65.  
  66. #define DBNOERR         -1
  67.  
  68. /*
  69. ** Default size of row buffer.  This is what people get if they do
  70. ** a dbsetopt(dbproc, DBBUFFER, 0).
  71. */
  72. #define DBBUFSIZE       1000
  73.  
  74. /* The size of a SYBTEXT timestamp, in bytes. This timestamp is not to be
  75.  * confused with a browse-mode timestamp.
  76.  */
  77. #define DBTXTSLEN       8
  78.  
  79. /* The size of a text-pointer, in bytes. */
  80. #if !VMS
  81. #define DBTXPLEN        ((DBTINYINT)16)
  82. #else
  83. #define DBTXPLEN        ((unsigned char)16)
  84. #endif
  85.  
  86. /*
  87. ** this is defined in the SQL Server server.h but it has alot of other 
  88. ** stuff that we don't want.
  89. */
  90. #define DBMAXNAME       30      /* Less like to collide with users' names
  91.                                  * than "MAXNAME".
  92.                                  */
  93. #define MAXNAME         30      /* Still here, so old programs won't
  94.                                  * break yet.
  95.                                  */
  96. #define MINSECLEVEL     1
  97. #define MAXSECLEVEL     16
  98.  
  99. #include        <syblogin.h>
  100.  
  101. #define DBMAXCHAR       256
  102. #define DBMAXCOLNAME    30
  103. #define DBMAXBYLIST     16
  104.  
  105. #define DBDATE_YY       0       /* year         1753 - 9999 */
  106. #define DBDATE_QQ       1       /* quarter      1 - 4 */
  107. #define DBDATE_MM       2       /* month        January - December */
  108. #define DBDATE_DW       3       /* weekday      Monday - Sunday */
  109. #define DBDATE_DD       4       /* day          1 - 31 */
  110. #define DBDATE_DY       5       /* dayofyear    1 - 366 */
  111. #define DBDATE_HH       6       /* hour         0 - 23 */
  112. #define DBDATE_MI       7       /* minute       0 - 59 */
  113. #define DBDATE_SS       8       /* second       0 - 59 */
  114. #define DBDATE_MS       9       /* millisecond  0 - 999 */
  115. #define DBDATE_WK       10      /* week         1 - 54 (for leap years) */
  116.  
  117. /* maximum printing lengths for fixed-length data */
  118. #define PRINT4  11
  119. #define PRINT2  6
  120. #define PRINT1  3
  121. #define PRFLT8  20
  122. #define PRFLT4  20
  123. #define PRMONEY 24
  124. #define PRMONEY4        24
  125. #define PRBIT   1
  126. #define PROLDDATETIME   20      /* for backward compatibility */
  127. #define PRDATETIME      26
  128. #define PRDATETIME4     26
  129. #define PRLDATETIME     30      /* includes milliseconds */
  130.  
  131. /* constant definitions for dbsafestr()'s quotetype parameter */
  132. #define DBSINGLE                0
  133. #define DBDOUBLE                1
  134. #define DBBOTH                  2
  135.  
  136. /* status values returned by dbxlate() */
  137. #define DBXLATE_XOK     0
  138. #define DBXLATE_XOF     1
  139. #define DBXLATE_XPAT    2
  140.  
  141.  
  142. /* SQL Server variable typedefs */
  143. typedef unsigned short  DBUSMALLINT;    /* SQL Server 2 byte integer */
  144. typedef struct dbvarychar               /* Pascal-type string. */
  145. {
  146.         DBSMALLINT      len;            /* length of the character string */
  147.         DBCHAR          str[DBMAXCHAR]; /* string, with no NULL terminator */
  148. } DBVARYCHAR;
  149. typedef struct dbvarybin                /* Pascal-type binary array. */
  150. {
  151.         DBSMALLINT      len;            /* length of the binary array */
  152.         BYTE            array[DBMAXCHAR];/* the array itself. */
  153. } DBVARYBIN;
  154.  
  155. #define TINYBIND        1
  156. #define SMALLBIND       2
  157. #define INTBIND         3
  158. #define CHARBIND        4
  159. #define TEXTBIND        5
  160. #define BINARYBIND      6
  161. #define ARRAYBIND       7
  162. #define BITBIND         8
  163. #define DATETIMEBIND    9
  164. #define MONEYBIND       10
  165. #define FLT8BIND        11
  166. #define STRINGBIND      12
  167. #define NTBSTRINGBIND   13
  168. #define VARYCHARBIND    14
  169. #define VARYBINBIND     15
  170. #define SMALLDATETIMEBIND       16
  171. #define SMALLMONEYBIND  17
  172. #define REALBIND        18
  173. #if VOS
  174. #define FIXEDBIND       19                      /*kvk589*/
  175. #define PACKEDBIND      20                      /*kvk589*/
  176. #define MAXBIND         PACKEDBIND              /*kvk589*/
  177. #else
  178. #define MAXBIND         REALBIND
  179. #endif
  180.  
  181. /*
  182. ** From pss.h SQL Server structure.
  183. */
  184. /* Donepacket status bit defs go here */
  185. # define DONE_CONT      (DBUSMALLINT) 0x1       
  186. # define DONE_ERROR     (DBUSMALLINT) 0x2
  187. # define DONE_INXACT    (DBUSMALLINT) 0x4
  188. # define DONE_PROC      (DBUSMALLINT) 0x8
  189. # define DONE_COUNT     (DBUSMALLINT) 0x10
  190. # define DONE_ATTN      (DBUSMALLINT) 0x20
  191. # define DONE_EVENT     (DBUSMALLINT) 0x40
  192.  
  193. /*
  194. **    OFFSETS DEFINITIONS
  195. **
  196. **    These are a subset of the token values for offset information.
  197. **    These defines come from y.tab.h
  198. **
  199. */
  200. #define _SELECT 365
  201. #define _EXECUTE 330
  202. #define _FROM 335
  203. #define _ORDER 357
  204. #define _COMPUTE 313
  205. #define _TABLE 371
  206. #define _PROCEDURE 362
  207. #define _STATEMENT 459
  208. #define _PARAM 452
  209.  
  210. /* end y.tab.h */
  211.  
  212. /* DB-LIBRARY minor error numbers */
  213. #define SYBESYNC        20001   /* Read attempted while out of synchronization
  214.                                  * with SQL Server.
  215.                                  */
  216. #define SYBEFCON        20002   /* SQL Server connection failed. */
  217. #define SYBETIME        20003   /* SQL Server connection timed out. */
  218. #define SYBEREAD        20004   /* Read from SQL Server failed. */
  219. #define SYBEBUFL        20005   /* DB-LIBRARY internal error - send buffer
  220.                                  * length corrupted.
  221.                                  */
  222. #define SYBEWRIT        20006   /* Write to SQL Server failed. */
  223. #define SYBEVMS         20007   /* Sendflush: VMS I/O error. */
  224. #define SYBESOCK        20008   /* Unable to open socket */
  225. #define SYBECONN        20009   /* Unable to connect socket -- SQL Server is
  226.                                  * unavailable or does not exist.
  227.                                  */
  228. #define SYBEMEM         20010   /* Unable to allocate sufficient memory */
  229. #define SYBEDBPS        20011   /* Maximum number of DBPROCESSes
  230.                                  * already allocated.
  231.                                  */
  232. #define SYBEINTF        20012   /* Server name not found in interface file */
  233. #define SYBEUHST        20013   /* Unknown host machine name */
  234. #define SYBEPWD         20014   /* Incorrect password. */
  235. #define SYBEOPIN        20015   /* Could not open interface file. */
  236. #define SYBEINLN        20016   /* Interface file: unexpected end-of-line. */
  237. #define SYBESEOF        20017   /* Unexpected EOF from SQL Server. */
  238. #define SYBESMSG        20018   /* General SQL Server error: Check messages
  239.                                  * from the SQL Server.
  240.                                  */
  241. #define SYBERPND        20019   /* Attempt to initiate a new SQL Server
  242.                                  * operation with results pending.
  243.                                  */
  244. #define SYBEBTOK        20020   /* Bad token from SQL Server: Data-stream
  245.                                  * processing out of sync.
  246.                                  */
  247. #define SYBEITIM        20021   /* Illegal timeout value specified. */
  248. #define SYBEOOB         20022   /* Error in sending out-of-band data to
  249.                                  * SQL Server.
  250.                                  */
  251. #define SYBEBTYP        20023   /* Unknown bind type passed to DB-LIBRARY
  252.                                  * function.
  253.                                  */
  254. #define SYBEBNCR        20024   /* Attempt to bind user variable to a
  255.                                  * non-existent compute row.
  256.                                  */
  257. #define SYBEIICL        20025   /* Illegal integer column length returned by
  258.                                  * SQL Server. Legal integer lengths are 1, 2,
  259.                                  * and 4 bytes.
  260.                                  */
  261. #define SYBECNOR        20026   /* Column number out of range. */
  262. #define SYBENPRM        20027   /* NULL parameter not allowed for this
  263.                                  * dboption.
  264.                                  */
  265. #define SYBEUVDT        20028   /* Unknown variable-length datatype encountered.
  266.                                  */
  267. #define SYBEUFDT        20029   /* Unknown fixed-length datatype encountered. */
  268. #define SYBEWAID        20030   /* DB-LIBRARY internal error: ALTFMT following
  269.                                  * ALTNAME has wrong id.
  270.                                  */
  271. #define SYBECDNS        20031   /* Datastream indicates that a compute column is
  272.                                  * derived from a non-existent select-list
  273.                                  * member.
  274.                                  */
  275. #define SYBEABNC        20032   /* Attempt to bind to a non-existent column. */
  276. #define SYBEABMT        20033   /* User attempted a dbbind() with mismatched
  277.                                  * column and variable types.
  278.                                  */
  279. #define SYBEABNP        20034   /* Attempt to bind using NULL pointers. */
  280. #define SYBEAAMT        20035   /* User attempted a dbaltbind() with mismatched
  281.                                  * column and variable types.
  282.                                  */
  283. #define SYBENXID        20036   /* The Server did not grant us a
  284.                                  * distributed-transaction ID.
  285.                                  */
  286. #define SYBERXID        20037   /* The Server did not recognize our
  287.                                  * distributed-transaction ID.
  288.                                  */
  289. #define SYBEICN         20038   /* Invalid computeid or compute column number.
  290.                                  */
  291. #define SYBENMOB        20039   /* No such member of 'order by' clause. */
  292. #define SYBEAPUT        20040   /* Attempt to print unknown token. */
  293. #define SYBEASNL        20041   /* Attempt to set fields in a null loginrec. */
  294. #define SYBENTLL        20042   /* Name too long for loginrec field. */
  295. #define SYBEASUL        20043   /* Attempt to set unknown loginrec field. */
  296. #define SYBERDNR        20044   /* Attempt to retrieve data from a non-existent
  297.                                  * row.
  298.                                  */
  299. #define SYBENSIP        20045   /* Negative starting index passed to dbstrcpy().
  300.                                  */
  301. #define SYBEABNV        20046   /* Attempt to bind to a NULL program variable.
  302.                                  */
  303. #define SYBEDDNE        20047   /* DBPROCESS is dead or not enabled. */
  304. #define SYBECUFL        20048   /* Data-conversion resulted in underflow. */
  305. #define SYBECOFL        20049   /* Data-conversion resulted in overflow. */
  306. #define SYBECSYN        20050   /* Attempt to convert data stopped by syntax
  307.                                  * error in source field.
  308.                                  */
  309. #define SYBECLPR        20051   /* Data-conversion resulted in loss of
  310.                                  * precision.
  311.                                  */
  312. #define SYBECNOV        20052   /* Attempt to set variable to NULL resulted
  313.                                  * in overflow.
  314.                                  */
  315. #define SYBERDCN        20053   /* Requested data-conversion does not exist. */
  316. #define SYBESFOV        20054   /* dbsafestr() overflowed its destination
  317.                                  * buffer.
  318.                                  */
  319. #define SYBEUNT         20055   /* Unknown network type found in
  320.                                  * interface file.
  321.                                  */
  322. #define SYBECLOS        20056   /* Error in closing network connection. */
  323. #define SYBEUAVE        20057   /* Unable to allocate VMS event flag. */
  324. #define SYBEUSCT        20058   /* Unable to set communications timer. */
  325. #define SYBEEQVA        20059   /* Error in queueing VMS AST routine. */
  326. #define SYBEUDTY        20060   /* Unknown datatype encountered. */
  327. #define SYBETSIT        20061   /* Attempt to call dbtsput() with an
  328.                                  * invalid timestamp.
  329.                                  */
  330. #define SYBEAUTN        20062   /* Attempt to update the timestamp of a table
  331.                                  * which has no timestamp column.
  332.                                  */
  333. #define SYBEBDIO        20063   /* Bad bulk-copy direction.  Must be either
  334.                                  * IN or OUT.
  335.                                  */
  336. #define SYBEBCNT        20064   /* Attempt to use Bulk Copy with a non-existent
  337.                                  * Server table.
  338.                                  */
  339. #define SYBEIFNB        20065   /* Illegal field number passed to bcp_control().
  340.                                  */
  341. #define SYBETTS         20066   /* The table which bulk-copy is attempting to
  342.                                  * copy to a host-file is shorter than the
  343.                                  * number of rows which bulk-copy was instructed
  344.                                  * to skip.
  345.                                  */
  346. #define SYBEKBCO        20067   /* 1000 rows successfully bulk-copied to
  347.                                  * host-file.
  348.                                  */
  349. #define SYBEBBCI        20068   /* Batch successfully bulk-copied to SQL Server.
  350.                                  */
  351. #define SYBEKBCI        20069   /* Bcp: 1000 rows sent to SQL Server. */
  352. #define SYBEBCRE        20070   /* I/O error while reading bcp data-file. */
  353. #define SYBETPTN        20071   /* Syntax error: only two periods are permitted
  354.                                  * in table names.
  355.                                  */
  356. #define SYBEBCWE        20072   /* I/O error while writing bcp data-file. */
  357. #define SYBEBCNN        20073   /* Attempt to bulk-copy a NULL value into
  358.                                  * Server column %d,  which does not accept
  359.                                  * NULL values.
  360.                                  */
  361. #define SYBEBCOR        20074   /* Attempt to bulk-copy an oversized row to the
  362.                                  * SQL Server.
  363.                                  */
  364. #define SYBEBCIS        20075   /* Attempt to bulk-copy an illegally-sized
  365.                                  * column value to the SQL Server.
  366.                                  */
  367. #define SYBEBCPI        20076   /* bcp_init() must be called before any other
  368.                                  * bcp routines.
  369.                                  */
  370. #define SYBEBCPN        20077   /* bcp_bind(), bcp_collen() and bcp_colptr()
  371.                                  * may be used only after bcp_init() has been
  372.                                  * called with the copy direction set to DB_IN.
  373.                                  */
  374. #define SYBEBCPB        20078   /* bcp_bind() may NOT be used after bcp_init()
  375.                                  * has been passed a non-NULL input file name.
  376.                                  */
  377. #define SYBEVDPT        20079   /* For bulk copy, all variable-length data
  378.                                  * must have either a length-prefix or a
  379.                                  * terminator specified.
  380.                                  */
  381. #define SYBEBIVI        20080   /* bcp_columns() and bcp_colfmt() may be used
  382.                                  * only after bcp_init() has been passed a
  383.                                  * valid input file.
  384.                                  */
  385. #define SYBEBCBC        20081   /* bcp_columns() must be called before
  386.                                  * bcp_colfmt().
  387.                                  */
  388. #define SYBEBCFO        20082   /* Bcp host-files must contain at least one
  389.                                  * column.
  390.                                  */
  391. #define SYBEBCVH        20083   /* bcp_exec() may be called only after
  392.                                  * bcp_init() has been passed a valid host file.
  393.                                  */
  394. #define SYBEBCUO        20084   /* Bcp: Unable to open host data-file. */
  395. #define SYBEBCUC        20085   /* Bcp: Unable to close host data-file. */
  396. #define SYBEBUOE        20086   /* Bcp: Unable to open error-file. */
  397. #define SYBEBUCE        20087   /* Bcp: Unable to close error-file. */
  398. #define SYBEBWEF        20088   /* I/O error while writing bcp error-file. */
  399. #define SYBEASTF        20089   /* VMS: Unable to setmode for control_c ast. */
  400. #define SYBEUACS        20090   /* VMS: Unable to assign channel to sys$command.
  401.                                  */
  402. #define SYBEASEC        20091   /* Attempt to send an empty command buffer to
  403.                                  * the SQL Server.
  404.                                  */
  405. #define SYBETMTD        20092   /* Attempt to send too much TEXT data via the
  406.                                  * dbmoretext() call.
  407.                                  */
  408. #define SYBENTTN        20093   /* Attempt to use dbtxtsput() to put a new
  409.                                  * text-timestamp into a non-existent data row.
  410.                                  */
  411. #define SYBEDNTI        20094   /* Attempt to use dbtxtsput() to put a new
  412.                                  * text-timestamp into a column whose datatype
  413.                                  * is neither SYBTEXT nor SYBIMAGE.
  414.                                  */
  415. #define SYBEBTMT        20095   /* Attempt to send too much TEXT data via the
  416.                                  * bcp_moretext() call.
  417.                                  */
  418. #define SYBEORPF        20096   /* Attempt to set remote password would
  419.                                  * overflow the login-record's remote-password
  420.                                  * field.
  421.                                  */
  422. #define SYBEUVBF        20097   /* Attempt to read an unknown version of BCP
  423.                                  * format-file.
  424.                                  */
  425. #define SYBEBUOF        20098   /* Bcp: Unable to open format-file. */
  426. #define SYBEBUCF        20099   /* Bcp: Unable to close format-file. */
  427. #define SYBEBRFF        20100   /* I/O error while reading bcp format-file. */
  428. #define SYBEBWFF        20101   /* I/O error while writing bcp format-file. */
  429. #define SYBEBUDF        20102   /* Bcp: Unrecognized datatype found in
  430.                                  * format-file.
  431.                                  */
  432. #define SYBEBIHC        20103   /* Incorrect host-column number found in bcp
  433.                                  * format-file.
  434.                                  */
  435. #define SYBEBEOF        20104   /* Unexpected EOF encountered in BCP data-file.
  436.                                  */
  437. #define SYBEBCNL        20105   /* Negative length-prefix found in BCP
  438.                                  * data-file.
  439.                                  */
  440. #define SYBEBCSI        20106   /* Host-file columns may be skipped only when
  441.                                  * copying INto the Server.
  442.                                  */
  443. #define SYBEBCIT        20107   /* It's illegal to use BCP terminators with
  444.                                  * program variables other than
  445.                                  * SYBCHAR, SYBBINARY, SYBTEXT, or SYBIMAGE.
  446.                                  */
  447. #define SYBEBCSA        20108   /* The BCP hostfile '%s' contains only %ld
  448.                                  * rows. Skipping all of these rows is not
  449.                                  * allowed.
  450.                                  */
  451. #define SYBENULL        20109   /* NULL DBPROCESS pointer passed to DB-Library.
  452.                                  */
  453. #define SYBEUNAM        20110   /* Unable to get current username from
  454.                                  * operating system.
  455.                                  */
  456. #define SYBEBCRO        20111   /* The BCP hostfile '%s' contains only %ld
  457.                                  * rows. It was impossible to read the
  458.                                  * requested %ld rows.
  459.                                  */
  460. #define SYBEMPLL        20112   /* Attempt to set maximum number of DBPROCESSes
  461.                                  * lower than 1.
  462.                                  */
  463. #define SYBERPIL        20113   /* It is illegal to pass -1 to dbrpcparam()
  464.                                  * for the datalen of parameters which are of
  465.                                  * type SYBCHAR, SYBVARCHAR, SYBBINARY, or
  466.                                  * SYBVARBINARY.
  467.                                  */
  468. #define SYBERPUL        20114   /* When passing a SYBINTN, SYBDATETIMN,
  469.                                  * SYBMONEYN, or SYBFLTN parameter via
  470.                                  * rpcparam(), it's necessary to specify
  471.                                  * the parameter's maximum or actual length,
  472.                                  * so that DB-Library can recognize it as
  473.                                  * a SYBINT1, SYBINT2, SYBINT4,
  474.                                  * SYBMONEY, or SYBMONEY4, etc.
  475.                                  */
  476. #define SYBEUNOP        20115   /* Unknown option passed to dbsetopt(). */
  477. #define SYBECRNC        20116   /* The current row is not a result of compute
  478.                                  * clause %d, so it is illegal to attempt to
  479.                                  * extract that data from this row.
  480.                                  */
  481. #define SYBERTCC        20117   /* dbreadtext() may not be used to receive
  482.                                  * the results of a query which contains a
  483.                                  * COMPUTE clause.
  484.                                  */
  485. #define SYBERTSC        20118   /* dbreadtext() may only be used to receive
  486.                                  * the results of a query which contains a
  487.                                  * single result column.
  488.                                  */
  489. #define SYBEUCRR        20119   /* Internal software error: Unknown
  490.                                  * connection result reported by                                                 * dbpasswd().
  491.                                  */
  492. #define SYBERPNA        20120   /* The RPC facility is available only when
  493.                                  * using a SQL Server whose version number
  494.                                  * is 4.0 or greater.
  495.                                  */
  496. #define SYBEOPNA        20121   /* The text/image facility is available only
  497.                                  * when using a SQL Server whose version number
  498.                                  * is 4.0 or greater.
  499.                                  */
  500. #define SYBEFGTL        20122   /* Bcp: Row number of the first row to be copied
  501.                                  * cannot be greater than the row number for the
  502.                                  * last row to be copied. 
  503.                                  */
  504. #define SYBECWLL        20123   /* Attempt to set column width less than 1. 
  505.                                  */
  506. #define SYBEUFDS        20124   /* Unrecognized format encountered in
  507.                                  * dbstrbuild().
  508.                                  */
  509. #define SYBEUCPT        20125   /* Unrecognized custom-format parameter-type
  510.                                  * encountered in dbstrbuild().
  511.                                  */
  512. #define SYBETMCF        20126   /* Attempt to install too many custom formats
  513.                                  * via dbfmtinstall().
  514.                                  */
  515. #define SYBEAICF        20127   /* Error in attempting to install custom
  516.                                  * format.
  517.                                  */
  518. #define SYBEADST        20128   /* Error in attempting to determine the size
  519.                                  * of a pair of translation tables.
  520.                                  */
  521. #define SYBEALTT        20129   /* Error in attempting to load a pair
  522.                                  * of translation tables.
  523.                                  */
  524. #define SYBEAPCT        20130   /* Error in attempting to perform a
  525.                                  * character-set translation.
  526.                                  */
  527. #define SYBEXOCI        20131   /* A character-set translation overflowed its
  528.                                  * destination buffer while using bcp to copy
  529.                                  * data from a host-file to the SQL Server.
  530.                                  */
  531. #define SYBEFSHD        20132   /* Error in attempting to find the Sybase
  532.                                  * home directory.
  533.                                  */
  534. #define SYBEAOLF        20133   /* Error in attempting to open a localization
  535.                                  * file.
  536.                                  */
  537. #define SYBEARDI        20134   /* Error in attempting to read datetime
  538.                                  * information from a localization file.
  539.                                  */
  540. #define SYBEURCI        20135   /* Unable to read copyright information
  541.                                  * from the dblib localization file.
  542.                                  */
  543. #define SYBEARDL        20136   /* Error in attempting to read the dblib.loc
  544.                                  * localization file.
  545.                                  */
  546. #define SYBEURMI        20137   /* Unable to read money-format information
  547.                                  * from the dblib localization file.
  548.                                  */
  549. #define SYBEUREM        20138   /* Unable to read error mnemonic
  550.                                  * from the dblib localization file.
  551.                                  */
  552. #define SYBEURES        20139   /* Unable to read error string
  553.                                  * from the dblib localization file.
  554.                                  */
  555. #define SYBEUREI        20140   /* Unable to read error information from
  556.                                  * the dblib localization file.
  557.                                  */
  558. #define SYBEOREN        20141   /* Warning: an out-of-range error-number was
  559.                                  * encountered in dblib.loc. The maximum
  560.                                  * permissible error-number is defined
  561.                                  * as DBERRCOUNT in sybdb.h.
  562.                                  */
  563. #define SYBEISOI        20142   /* Invalid sort-order information found. */
  564. #define SYBEIDCL        20143   /* Illegal datetime column length returned by
  565.                                  * DataServer. Legal datetime lengths are 4
  566.                                  * and 8 bytes.
  567.                                  */
  568. #define SYBEIMCL        20144   /* Illegal money column length returned by
  569.                                  * DataServer. Legal money lengths are 4
  570.                                  * and 8 bytes.
  571.                                  */
  572. #define SYBEIFCL        20145   /* Illegal floating-point column length
  573.                                  * returned by DataServer. Legal floating-point
  574.                                  * lengths are 4 and 8 bytes.
  575.                                  */
  576. #define SYBEUTDS        20146   /* Unrecognized TDS version received from
  577.                                  * SQL Server.
  578.                                  */
  579. #define SYBEBUFF        20147   /* Bcp: Unable to create format-file. */
  580. #define SYBEACNV        20148   /* Attemp to do conversion with NULL destination
  581.                                  * variable.
  582.                                  */
  583. #define SYBEDPOR        20149   /* Out-of-range datepart constant. */
  584. #define SYBENDC         20150   /* Cannot have negative component in date
  585.                                 ** in numeric form.
  586.                                 */
  587. #define SYBEMVOR        20151   /* Month values must be between 1 and 12. */
  588. #define SYBEDVOR        20152   /* Day values must be between 1 and 7. */
  589. #define SYBENBVP        20153   /* Cannot pass dbsetnull() a NULL bindval
  590.                                 ** pointer.
  591.                                 */
  592. #define SYBESPID        20154   /* Called dbspid() with a NULL dbproc. */
  593. #define SYBENDTP        20155   /* Called dbdatecrack() with a NULL datetime 
  594.                                 ** parameter.
  595.                                 */
  596. #define SYBEXTN         20156   /* The xlt_todisp and xlt_tosrv parameters
  597.                                 ** to dbfree_xlate() were NULL.
  598.                                 */
  599. #define SYBEXTDN        20157   /* Warning:  the xlt_todisp parameter to
  600.                                 ** dbfree_xlate() was NULL.  The space
  601.                                 ** associated with the xlt_tosrv parameter
  602.                                 ** has been freed.
  603.                                 */
  604. #define SYBEXTSN        20158   /* Warning:  the xlt_tosrv parameter to
  605.                                 ** dbfree_xlate() was NULL.  The space
  606.                                 ** associated with the xlt_todisp parameter
  607.                                 ** has been freed.
  608.                                 */
  609. #define SYBENUM         20159   /* Incorrect number of arguments given 
  610.                                  ** to DB-Library. 
  611.                                  */
  612. #define SYBETYPE        20160   /* Invalid argument type given to DB-Library. */
  613. #define SYBEGENOS       20161   /* General Operating System Error.*/
  614. #define SYBEPAGE        20162   /* wrong resource type or length given for 
  615.                                 ** dbpage() operation. 
  616.                                 */
  617. #define SYBEOPTNO       20163   /* Option is not allowed or is unreconized*/
  618. #define SYBEETD         20164   /*"Failure to send the expected amount of 
  619.                                 ** TEXT or IMAGE data via dbmoretext().
  620.                                 */
  621. #define SYBERTYPE       20165   /* Invalid resource type given to DB-Library. */
  622. #define SYBERFILE       20166   /* "Can not open resource file." */
  623. #define SYBEFMODE       20167   /* Read/Write/Append mode denied on file.*/
  624. #define SYBESLCT        20168   /* Could not select or copy field specified */
  625. #define SYBEZTXT        20169   /* Attempt to send zero length TEXT or 
  626.                                 ** IMAGE to dataserver via dbwritetext().
  627.                                 */
  628. #define SYBENTST        20170   /* The file being opened must be a stream_lf.
  629.                                 */
  630. #define SYBEOSSL        20171   /* Operating system login level not in range
  631.                                  * of Secure SQL Server
  632.                                  */
  633. #define SYBEESSL        20172   /* Login security level entered does not agree
  634.                                  * with operating system level
  635.                                  */
  636. #define SYBENLNL        20173   /* Program not linked with specified
  637.                                 ** network library.
  638.                                 */
  639. #define SYBENHAN        20174   /* called dbrecvpassthru() with a NULL
  640.                                 ** handler parameter.
  641.                                 */
  642. #define SYBENBUF        20175   /* called dbsendpassthru() with a NULL
  643.                                 ** buf pointer.
  644.                                 */
  645. #define SYBENULP        20176   /* Called %s with a NULL %s parameter.
  646.                                 */
  647. #define SYBENOTI        20177   /* No event handler installed. */
  648. #define SYBEEVOP        20178   /* Called dbregwatch() with a bad
  649.                                 ** options parameter.
  650.                                 */
  651. #define SYBENEHA        20179   /* Called dbreghandle() with a NULL
  652.                                 ** handler parameter.
  653.                                 */
  654. #define SYBETRAN        20180   /* DBPROCESS is being used for another
  655.                                 ** transaction.
  656.                                 */
  657. #define SYBEEVST        20181   /* Must initiate a transaction before
  658.                                 ** calling dbregparam().
  659.                                 */
  660. #define SYBEEINI        20182   /* Must call dbreginit() before
  661.                                 ** dbregraise().
  662.                                 */
  663. #define SYBEECRT        20183   /* Must call dbregdefine() before
  664.                                 ** dbregcreate().
  665.                                 */
  666. #define SYBEECAN        20184   /* Attempted to cancel unrequested
  667.                                 ** event notification.
  668.                                 */
  669. #define SYBEEUNR        20185   /* Unsolicited event notification received.
  670.                                 */
  671. #define SYBERPCS        20186   /* Must call dbrpcinit() before dbrpcparam().
  672.                                 */
  673. #define SYBETPAR        20187   /* No SYBTEXT or SYBIMAGE parameters were
  674.                                 ** defined.
  675.                                 */
  676. #define SYBETEXS        20188   /* Called dbmoretext() with a bad size
  677.                                 ** parameter.
  678.                                 */
  679. #define SYBETRAC        20189   /* Attempted to turn off a trace flag
  680.                                 ** that was not on.
  681.                                 */
  682. #define SYBETRAS        20190   /* DB-Library internal error - trace
  683.                                 ** structure not found.
  684.                                 */
  685. #define SYBEPRTF        20191   /* dbtracestring() may only be called
  686.                                 ** from a printfunc().
  687.                                 */
  688. #define SYBETRSN        20192   /* Bad numbytes parameter passed to
  689.                                 ** dbtracestring().
  690.                                 */
  691. #define SYBEBPKS        20193   /* In DBSETLPACKET(), the packet size parameter
  692.                                 ** must be between 0 and 999999.
  693.                                 */
  694. #define SYBEIPV         20194   /* %1! is an illegal value for the %2!
  695.                                 ** parameter of %3!.
  696.                                 */
  697. #define SYBEMOV         20195   /* Money arithmetic resulted in overflow in
  698.                                 ** function %1!.
  699.                                 */
  700. #define SYBEDIVZ        20196   /* Attempt to divide by $0.00 in function
  701.                                 ** %1!.
  702.                                 */
  703. #define SYBEASTL        20197   /* Synchronous I/O attempted at AST level.
  704.                                 */
  705. #define SYBESEFA        20198   /* DBSETNOTIFS cannot be called if
  706.                                 ** connections are present.
  707.                                 */ 
  708. #define SYBEPOLL    20199    /* Only one dbpoll() can be active at a
  709.                 ** time.
  710.                 */
  711. #define SYBENOEV    20200    /* dbpoll() cannot be called if registered
  712.                 ** procedure notifications have been disabled.
  713.                 */
  714. #define SYBEBADPK    20201    /* Packet size of %1! not supported. --
  715.                 ** size of %2! used instead.
  716.                 */
  717.  
  718. /* WARNING: whenever a new DB-Library error message is added,
  719.  * increment DBERRCOUNT.
  720.  */
  721. #define DBERRCOUNT      201
  722.  
  723.  
  724. /*
  725. ** Define the symbol which denotes a null-terminated string length.
  726. */
  727. #define DBNULLTERM      -1
  728.  
  729. /* These are the codes returned by dbpoll(): */
  730. #define DBRESULT        1
  731. #define DBNOTIFICATION  2
  732. #define DBTIMEOUT       3
  733. #define DBINTERRUPT     4
  734.  
  735. #if VMS
  736.  
  737. /* Define the flags for db_readflags */
  738. #define DBRPFILL        1               /* pending recvfill_a completed */
  739. #define DBRPENDING      2               /* pending recvfill_a still pending */
  740. #define DBRPSFILLW      4               /* sync fill invoked and waiting */
  741. #define DBRPASFILLW     8               /* async fill invoked and waiting */
  742. #define DBPOLLWAIT      16              /* dbproc specific dbpoll waiting */
  743. #define DBRPSTART       32              /* read pending start up */
  744. #define DBRPSHUT        64              /* socket/channel shutting down ignore
  745.                                         ** and recvfill_a error */
  746. #define DBRNOMORE       128             /* do not read next token */
  747. #define DBRINOPEN       256             /* dbproc is still being opened and
  748.                                         ** may need to resize buffers.
  749.                                         ** Therefore, we won't do any read
  750.                                         ** ahead until after the buffers
  751.                                         ** would have been resized.
  752.                                         */
  753. #define DBPOLLWAIT_A    512             /* asynchronous dbpoll waiting */
  754. #define DBPOLL_TIMER    1024        /* The timer is still set for dbpoll */
  755. #define DBPWTIMEOUT    2048        /* The recvpendwait was timed out */
  756.  
  757. /* db_vmsflags (in global structure) */
  758. #define DBDOEVENTS      1
  759. /*                     16 - DBPOLLWAIT as above same field global function */
  760. /*                    512 - DBPOLLWAIT_A as above same field global function */
  761. /*                   1024 - DBPOLL_TIMER as above same field global function */
  762.  
  763. #endif /* VMS */
  764. /* The DBSORTORDER structure is used by dbloadsort(), dbstrcmp(), dbstrsort(),
  765.  * and dbfreesort().
  766.  */
  767. typedef struct dbsortorder {
  768.         DBVOIDPTR       sort;
  769. } DBSORTORDER;
  770.  
  771. /* The DBDATEREC structure is used by dbdatecrack(): */
  772.  
  773. typedef struct dbdaterec
  774. {
  775.         long    dateyear;       /* 1900 to the future */
  776.         long    datemonth;      /* 0 - 11 */
  777.         long    datedmonth;     /* 1 - 31 */
  778.         long    datedyear;      /* 1 - 366 */
  779.         long    datedweek;      /* 0 - 6 (Mon. - Sun.) */
  780.         long    datehour;       /* 0 - 23 */
  781.         long    dateminute;     /* 0 - 59 */
  782.         long    datesecond;     /* 0 - 59 */
  783.         long    datemsecond;    /* 0 - 997 */
  784.         long    datetzone;      /* 0 - 127 */
  785. } DBDATEREC;
  786.  
  787. /*
  788. ** HOSTSERVER.h - structures and defines for communicating with server
  789. **
  790. */
  791.  
  792. /*
  793. ** Data structure used by both send and recv
  794. */
  795. typedef struct servbuf
  796. {
  797.         BYTE    *serv_sbuf;     /* send: start of send buffer */
  798.         BYTE    *serv_snb;      /* send: next place in buffer */
  799.         int     serv_sleft;     /* send: room left in send buffer */
  800.         int     serv_sbsize;    /* send: buffer size */
  801.         int     serv_snum;      /* send # for network */
  802.         int     serv_sstat;     /* send: status bits */
  803.         BYTE    *serv_rbuf;     /* recv: start of recv buffer */
  804.         BYTE    *serv_rnb;      /* recv: next place in buffer */
  805.         int     serv_rleft;     /* recv: room left in recv buffer */
  806.         int     serv_rbsize;    /* recv: buffer size */
  807.         int     serv_rnum;      /* recv # for network */
  808.         int     serv_rstat;     /* recv: status bits */
  809.         int     serv_commtype;  /* communications type (tcp, etc.) */
  810.         RETCODE (*serv_attn)(); /* network-dependent routine to send
  811.                                  * an ATTN packet to the SQL Server.
  812.                                  */
  813.         DBINT   (*serv_read)(); /* network-dependent routine to read
  814.                                  * a byte stream from the SQL Server.
  815.                                  */
  816.         RETCODE (*serv_read_a)();/* async version of serv_read(). */
  817.         DBINT   (*serv_writ)(); /* network-dependent routine to write
  818.                                  * a byte stream to the SQL Server.
  819.                                  */
  820.         RETCODE (*serv_clos)(); /* network-dependent routine to close
  821.                                  * a connection to the SQL Server.
  822.                                  */
  823.         BYTE    serv_rbuftype;  /* packet type of the last read buffer */
  824. } SERVBUF;
  825.  
  826.  
  827. /*
  828. **  DBSTRING - This structure is just used for stringing text or parameters
  829. **      together.
  830. */
  831. struct dbstring
  832. {
  833.         BYTE    *strtext;       /* actual byte string */
  834.         DBINT   strtotlen;      /* allocated length of the byte string */
  835.         struct dbstring *strnext;
  836. };
  837. typedef struct dbstring DBSTRING;
  838.  
  839. /*
  840. **      DBROWDATA - This structure is used to hold the actual data that
  841. **      comes back for every column in every row. The DBPROCESS structure
  842. **      points to a linked-list of DBROW structures. Each DBROW strcture points
  843. **      to an array of DBROWDATA structures. Since every DBROWDATA structure
  844. **      contains pointers to separately allocated buffers, the members of
  845. **      each array are linked together in a singly-linked list, to facilitate
  846. **      the operation of simple row-freeing routines.
  847. */
  848. struct dbrowdata
  849. {
  850.         BYTE            *data;          /* actual data for this column in this
  851.                                          * row
  852.                                          */
  853.         DBINT           datlen;         /* length, in bytes, of this data */
  854.     DBINT        maxtxtlen;    /* This used to keep track of the 
  855.                      * largest SYBTEXT/SYBIMAGE column
  856.                      * received so far.
  857.                      */
  858.         DBBINARY        dattxptr[DBTXPLEN];/* This data's text-ptr, if it's of
  859.                                          * type SYBTEXT.
  860.                                          */
  861.         DBTINYINT       dattxplen;      /* Length, in bytes, of the text-ptr. */
  862.         DBBINARY        dattxts[DBTXTSLEN];/* The text-timestamp of this text
  863.                                          * value.
  864.                                          */
  865.         DBTINYINT       dattxtslen;     /* Length, in bytes, of the
  866.                                          * text-timestamp.
  867.                                          */
  868.         struct dbrowdata        *datnext;
  869. };
  870. typedef struct dbrowdata        DBROWDATA;
  871.  
  872. /*
  873. **  BINDREC - This is the structure used to store information about
  874. **      which columns should be bound to which programming variables
  875. */
  876. struct  bindrec
  877. {
  878.         BYTE            *bindvar;       /* ptr to program variable */
  879.         DBINT           bindlen;        /* length of program variable */
  880.         int             (*bindproc)();  /* procedure to use for data copy. */
  881.         DBINT           *bindnullind;   /* IBM-type indicator variable. */
  882.         DBINT           bindtype;       /* variable for indexing convertfunc
  883.                                         ** tables.
  884.                                         */
  885. };
  886. typedef struct bindrec  BINDREC;
  887.  
  888. /*
  889. ** NULLBIND - This structure is attached to the DBPROCESS and is used
  890. **      to determine what to bind when bind values are NULL.
  891. */
  892. struct  nullbind
  893. {
  894.         DBBIT           nullbit;
  895.         DBTINYINT       nulltiny;
  896.         DBSMALLINT      nullsmall;
  897.         DBINT           nullint;
  898.         DBCHAR          *nullchar;
  899.         DBINT           nulllchar;      /* length of char string */
  900.         DBBINARY        *nullbinary;
  901.         DBINT           nulllbinary;    /* length of binary string */
  902.         DBDATETIME      nulldatetime;
  903.         DBMONEY         nullmoney;
  904.         DBFLT8          nullflt8;
  905.         DBCHAR          *nullstring;
  906.         DBCHAR          *nullntbstring;
  907.         DBVARYCHAR      nullvarychar;
  908.         DBVARYBIN       nullvarybin;
  909.         DBDATETIME4     nullsmalldatetime;
  910.         DBMONEY4        nullsmallmoney;
  911.         DBREAL          nullflt4;
  912. };
  913. typedef struct nullbind NULLBIND;
  914.  
  915. /*
  916. **  DBCOLINFO - This structure contains the format information about a column.
  917. **      There is a linked list of DBCOLINFO structures in the DBPROCESS
  918. **      structure.  There is one DBCOLINFO structure for each column in the
  919. **      target list of the current command.  Format information for
  920. **      alternate rows, like compute, is kept in the DBALTHEAD and
  921. **      DBALTINFO structures.
  922. */
  923. struct dbcolinfo
  924. {
  925.         char    colname[DBMAXCOLNAME+1];/* column name */
  926.         BYTE    coltype;                /* column type */
  927.         DBINT   coludtype;              /* user-defined type */
  928.         DBINT   collen;                 /* max length of column */
  929.         DBINT   colprlen;               /* max printing length of column */
  930.         char    *colcontrol;            /* control format, if any */
  931.         struct bindrec  colbind;        /* binding info, if any */
  932.         int     coltable;               /* for browse mode: which table
  933.                                          * did this column come from?
  934.                                          */
  935.         BYTE            colstatus;      /* for browse mode: what kind of column
  936.                                          * is this?
  937.                                          */
  938.         char    colorigname[DBMAXCOLNAME+1];/* for browse mode: what is the name
  939.                                          * of the table column that provided
  940.                                          * this select-list member?
  941.                                          */
  942.         char    *coltxobjname;          /* the SQL Server always returns the
  943.                                          * qualified object-name for TEXT
  944.                                          * columns.
  945.                                          */
  946.         struct dbcolinfo        *colnext;       /* next column */
  947. };
  948. typedef struct dbcolinfo        DBCOLINFO;
  949.  
  950. /*
  951. **  DBTABNAME - This structure contains information about the tables which
  952. **      were used to produce the current set of results. The SQL Server only
  953. **      provides this info for queries that are executed in "browse mode".
  954. **
  955. **      There is a linked list of DBTABNAME structures in the DBPROCESS
  956. **      structure.  There is one DBTABNAME structure for each table used to
  957. **      produce the target list of the current command.
  958. **
  959. **      If this query was executed without "browse mode", then this list will
  960. **      have no members.
  961. */
  962. struct dbtabname
  963. {
  964.         char                    tabname[DBMAXNAME+1];   /* column name */
  965.         struct dbtabname        *tabnext;               /* next column */
  966. };
  967. typedef struct dbtabname        DBTABNAME;
  968.  
  969. /*
  970. **  DBRETVAL - This structure contains any data which was returned as a function
  971. **      value by the last command. Currently, "browse-mode" updates are the only
  972. **      commands which return function values.
  973. **
  974. **      There is a linked list of DBRETVAL structures in the DBPROCESS
  975. **      structure.  There is one DBRETVAL structure for each function value
  976. **      returned by the current command.
  977. **
  978. **      If this command returned no function value, this list will
  979. **      have no members.
  980. */
  981. struct dbretval
  982. {
  983.         char            retname[DBMAXNAME+1];   /* value name */
  984.         BYTE            retvalstat;             /* status byte */
  985.         BYTE            rettype;                /* value type */
  986.         BYTE            retmaxlen;              /* max value length (ignored) */
  987.         BYTE            retlen;                 /* value length */
  988.         DBINT           retusertype;            /* user type */
  989.         BYTE            *retdata;               /* the return-value itself. */
  990.         struct dbretval *retnext;               /* next return-value */
  991. };
  992. typedef struct dbretval DBRETVAL;
  993.  
  994. /*
  995. **  DBALTHEAD - This structure contains information for ALT rows.  ALT
  996. **      rows are COMPUTE results.  There is one DBALTHEAD for each COMPUTE
  997. **      statement.  All the COMPUTE operators in a particular COMPUTE statement
  998. **      must have the same bylist -- this is enforced by the SQL Server.
  999. **      Off of each DBALTHEAD is a linked list of DBALTINFO structures that
  1000. **      describe the format for each particular COMPUTE operation in the
  1001. **      COMPUTE.
  1002. */
  1003. struct  dbalthead
  1004. {
  1005.         DBUSMALLINT     althid;         /* id for this COMPUTE statement */
  1006.         BYTE    althalts;       /* number of DBALTINFO structures in althlist */
  1007.         BYTE    althsizeby;     /* number of elements in the bylist */
  1008.         BYTE    althbylist[DBMAXBYLIST];        /* colids of bylist elements */
  1009.         struct dbaltinfo        *althlist;      /* linked list of DBALTINFOs */
  1010.         struct dbprlist         *althprlist;    /* order print list for aops */
  1011.         struct dbalthead        *althnext;      /* next dbalthead */
  1012. };
  1013. typedef struct dbalthead        DBALTHEAD;
  1014.  
  1015. typedef struct dbxlate
  1016. {
  1017.         void    *bufstart;      /* For use when freeing translation tables. */
  1018.         void    *xlate;         /* Points to an INTL_XLATE structure. */
  1019. } DBXLATE;
  1020.  
  1021. /*
  1022. **  DBPRLIST - This structure is used to create an 'ordered' printing list
  1023. **      for computes.  For example a compute might be:
  1024. **              compute sum(col1), avg(col2), sum(col2), avg(col3), avg(col1)
  1025. **      For printing, it would be nice to have a list that pointed to the
  1026. **      right DBALTINFO structures like this:
  1027. **              sum(col1)-->sum(col2)
  1028. **                |
  1029. **               \|/
  1030. **              avg(col1)-->avg(col2)-->avg(col3)
  1031. **      It is used by the praltrow function that dbprrow uses but the
  1032. **      information could be used by any DBLIB client.
  1033. */
  1034. struct  dbprlist
  1035. {
  1036.         DBROWDATA       *prdata;        /* actual data for the compute */
  1037.         struct dbaltinfo        *prtarget;      /* related ALTINFO struct */
  1038.         struct dbprlist         *prright;       /* next aop in compute */
  1039.         struct dbprlist         *prdown;        /* next compute in query */
  1040. };
  1041. typedef struct dbprlist DBPRLIST;
  1042.  
  1043. /*
  1044. **  DBALTINFO - This structure contains the format information about
  1045. **      alternate rows.  Compute clauses produce alternate rows of data,
  1046. **      interspersed with the regular data rows returned by the dataserver.
  1047. **      There is a linked list of DBALTHEAD structures in the DBPROCESS
  1048. **      structure.  There is one DBALTHEAD structure for each possible
  1049. **      type of alternate row of the current command.  Format information for
  1050. **      regular data rows is kept in the DBCOLINFO structure.
  1051. */
  1052. struct dbaltinfo
  1053. {
  1054.         char    *altname;       /* null terminated string to alt header */
  1055.         BYTE    alttoken;       /* type of alternate information */
  1056.         BYTE    altcolid;       /* which target list member referenced */
  1057.         BYTE    alttype;        /* column type */
  1058.         DBINT   altudtype;      /* user-defined type */
  1059.         DBINT   altlen;         /* max length of column */
  1060.         DBINT   altprlen;       /* printing length of data */
  1061.         char    *altcontrol;            /* control format, if any */
  1062.         struct dbprlist *altprlist;     /* ptr to ordered printing list */
  1063.         struct bindrec  altbind;        /* binding info, if any */
  1064.         struct dbaltinfo        *altnext;       /* next column */
  1065. };
  1066. typedef struct dbaltinfo        DBALTINFO;
  1067.  
  1068. /*
  1069. **  DBROW - This structure is used to store the actual row and alternate row
  1070. **      data returned by the dataserver.  The member of the DBPROCESS structure 
  1071. **      called dbfirstdata stores the doubly-linked list of rows.  If buffering
  1072. **      is off, only one row is stored.  The rows are stored in the order that
  1073. **      they are received from the server.
  1074. */
  1075. struct dbrow
  1076. {
  1077.         DBINT           rowid;          /* this is the returned row number */
  1078.         DBUSMALLINT     rowaltid;       /* for ALT rows, this is
  1079.                                          * DBALTINFO.altid
  1080.                                          */
  1081.         DBROWDATA       *rowdata;       /* actual data */
  1082.         DBBOOL          rowhasnull;     /* are there any NULLS in this row of
  1083.                                          * data?
  1084.                                          */
  1085.         struct dbrow    *rowprev;       /* previous row if buffering on */
  1086.         struct dbrow    *rownext;       /* next row if buffering on */
  1087.         SECLAB          dbseclab;       /* security label */
  1088.         unsigned long   dbcrc;          /* row crc */
  1089. };
  1090. typedef struct dbrow    DBROW;
  1091.  
  1092. /*
  1093. **  DBINFO - This structure is used to store information and error messages
  1094. **      returned by the dataserver.
  1095. **
  1096. **      NOTE - This structure is used by APT.
  1097. **              Adding or deleting structure members should be done with
  1098. **              care.
  1099. */
  1100. struct dbinfo
  1101. {
  1102.         DBINT           infonum;        /* error or info number */
  1103.         DBTINYINT       infostate;      /* error state number */
  1104.         DBTINYINT       infoclass;      /* info class or error severity */
  1105.         char            *infotext;      /* null terminated message */
  1106.         char            *infoservname;  /* null terminated Server-name */
  1107.         char            *infoprocname;  /* null terminated procedure-name */
  1108.         DBUSMALLINT     infolinenum;    /* stored-procedure line-number */
  1109.         struct dbinfo   *infonext;
  1110. };
  1111. typedef struct dbinfo   DBINFO;
  1112.  
  1113. /*
  1114. **  Options - both for the dataserver and DBLIB
  1115. **      As additional options are added, they should be added here and in
  1116. **      the Dboptdict array.
  1117. */
  1118.  
  1119. /*
  1120. ** dataserver options are defined in pss.h
  1121. ** dataserver options and their index into the Dboptdict array
  1122. ** Dboptdict is defined in options.c
  1123. */
  1124. #define DBPARSEONLY     0
  1125. #define DBESTIMATE      1       
  1126. #define DBSHOWPLAN      2
  1127. #define DBNOEXEC        3
  1128. #define DBARITHIGNORE   4
  1129. #define DBNOCOUNT       5
  1130. #define DBARITHABORT    6
  1131. #define DBTEXTLIMIT     7
  1132. #define DBBROWSE        8
  1133. #define DBOFFSET        9
  1134. #define DBSTAT          10
  1135. #define DBERRLVL        11
  1136. #define DBCONFIRM       12
  1137. #define DBSTORPROCID    13
  1138. #define DBBUFFER        14
  1139. #define DBNOAUTOFREE    15
  1140. #define DBROWCOUNT      16
  1141. #define DBTEXTSIZE      17
  1142. #define DBNATLANG       18
  1143. #define DBDATEFORMAT    19
  1144. #define DBPRPAD         20
  1145. #define DBPRCOLSEP      21
  1146. #define DBPRLINELEN     22
  1147. #define DBPRLINESEP     23
  1148. #define DBLFCONVERT     24
  1149.  
  1150. #define DBNUMOPTIONS    25      /* total number of Db-Lib options */
  1151.  
  1152. #define DBPADOFF        0
  1153. #define DBPADON         1
  1154.  
  1155. #define OFF             0
  1156. #define ON              1
  1157.  
  1158. /* RETCODES for option routines */
  1159. #define NOSUCHOPTION    2
  1160.  
  1161. /*
  1162. **  DBOPTION - This structure is used to store the current dataserver and
  1163. **      dblib options.
  1164. */
  1165. #define MAXOPTTEXT      32
  1166. struct dboption
  1167. {
  1168.         char    opttext[MAXOPTTEXT];
  1169.         DBSTRING        *optparam;      /* param to the option */
  1170.         DBUSMALLINT     optstatus;      /* status of option */
  1171.         DBBOOL  optactive;      /* is this structure active (being used?) */
  1172.         struct dboption *optnext;       /* for different versions of an option */
  1173. };
  1174. typedef struct dboption DBOPTION;
  1175.  
  1176.  
  1177. /*
  1178. ** These are the offset types recognized by the SQL Server
  1179. ** They are contained in the SQL Server header pss.h.  The _defines
  1180. ** come from y.tab.h.
  1181. */
  1182. #define OFF_SELECT      (DBUSMALLINT) _SELECT
  1183. #define OFF_EXEC        (DBUSMALLINT) _EXECUTE
  1184. #define OFF_FROM        (DBUSMALLINT) _FROM
  1185. #define OFF_ORDER       (DBUSMALLINT) _ORDER
  1186. #define OFF_COMPUTE     (DBUSMALLINT) _COMPUTE
  1187. #define OFF_TABLE       (DBUSMALLINT) _TABLE
  1188. #define OFF_PROCEDURE   (DBUSMALLINT) _PROCEDURE
  1189. #define OFF_STATEMENT   (DBUSMALLINT) _STATEMENT
  1190. #define OFF_PARAM       (DBUSMALLINT) _PARAM
  1191.  
  1192. /*
  1193. **  DBOFF - This structure is used to store text offset information.
  1194. **      This information is used to send back to the dataserver new
  1195. **      control formats.  
  1196. */
  1197. struct dboff
  1198. {
  1199.         DBUSMALLINT     offtype;        /* type of offset */
  1200.         DBUSMALLINT     offset;         /* actual offset */
  1201.         struct dboff    *offnext;
  1202. };
  1203. typedef struct dboff    DBOFF;
  1204.  
  1205. /*
  1206. **  DBDONE - This structure is just the dataserver done packet.
  1207. **      It has information about the completion of a command.
  1208. */
  1209. struct dbdone
  1210. {
  1211.         DBUSMALLINT     donestatus;     /* done status bits */
  1212.         DBUSMALLINT     doneinfo;       /* command specific info */
  1213.         DBINT           donecount;      /* done count -- rows for example */
  1214. };
  1215. typedef struct dbdone   DBDONE;
  1216.  
  1217. /* Status bits for DBPROCESS dbstatus */
  1218. #define READROW                 ((DBINT) 0x2)
  1219. #define INSPROC                 ((DBINT) 0x4)
  1220. #define EXECDONE                ((DBINT) 0x8)
  1221. #define NEWDB                   ((DBINT) 0x10)
  1222. #define DB__INRPC               ((DBINT) 0x20)
  1223. #define DB__INEVENTRAISE        ((DBINT) 0x40)
  1224. #define DB__INEVENTCREATE       ((DBINT) 0x80)
  1225. #define DB__GOTEVENT            ((DBINT) 0x0100)
  1226. #define DB__PASSTHRU            ((DBINT) 0x0200)
  1227. #define DB__TDSPRINTFUNC        ((DBINT) 0x0400)
  1228. #define DB__INLINENOTIFY        ((DBINT) 0x0800)
  1229. #define DB__READING_NOTIFY      ((DBINT) 0x1000)
  1230. #define DB__IN_EVENT_HANDLER    ((DBINT) 0x2000)
  1231. #define DB__TEXTPARAMS          ((DBINT) 0x4000)
  1232. #define DB__POLLEVENT           ((DBINT) 0x8000)
  1233. #define DBCANCELLING            ((DBINT) 0x10000)
  1234. #define DBTIMING_OUT            ((DBINT) 0x20000)
  1235.  
  1236.  
  1237. /* Possible flags for dbback_compatible(). Currently the only
  1238. ** one is DBEXTRARESULTS.
  1239. */
  1240. #define DBEXTRARESULTS  (DBUSMALLINT) 0x1
  1241.  
  1242. /* Bulk-copy information -- */
  1243.  
  1244. #define PERIOD  '.'     /* the separator... */
  1245.  
  1246. #define STATNULL        (BYTE) 0x08
  1247. #define IN              (BYTE) 1 /* TEMPORARY - for backward compatibility. */
  1248. #define OUT             (BYTE) 2 /* TEMPORARY - for backward compatibility. */
  1249. #define DB_IN           (BYTE) 1
  1250. #define DB_OUT          (BYTE) 2
  1251. #define BCPNAMELEN      255
  1252. #define DEFABORT        10              /* # of errors before we give up */
  1253. #define ERRFILE         "bcp.error"     /* default error file name */
  1254.  
  1255. /* BCP macros: */
  1256. #define BCP_SETL(a,b)           dbsetlbool((a), (b), DBSETBCP)
  1257.  
  1258. /* The fields for calls to bcpcontrol. */
  1259. #define BCPMAXERRS      1
  1260. #define BCPFIRST        2
  1261. #define BCPLAST         3
  1262. #define BCPBATCH        4
  1263. #define BCPERRFILE      5       /* TEMPORARY - for backward compatibility. */
  1264.  
  1265. /* This macro is used by the Non-C interfaces to BCP-Library: */
  1266. #define BCP_HOSTTYPE(a, b)      bcp_hosttype(a, b)
  1267.  
  1268. typedef struct  bcpparsetable
  1269. {
  1270.         char    dbname[DBMAXNAME+1];
  1271.         char    ownername[DBMAXNAME+1];
  1272.         char    tabname[DBMAXNAME+1];
  1273. } BCPPARSETABLE;
  1274.  
  1275. /*
  1276. **  BCPCOLDESC
  1277. **      This is the basic unit of information used for bulkcopy.
  1278. **      All the bulkcopy routines that talk with the SQL Server
  1279. **      routines pass an array of these.
  1280. */
  1281. typedef struct  bcpcoldesc
  1282. {
  1283.         BYTE    *cd_dvalue;             /* current value to be inserted */
  1284.         BYTE    *cd_defvalue;           /* default value to be inserted */
  1285.         DBINT   cd_dlen;                /* current length to be inserted */
  1286.         DBINT   cd_deflen;              /* length of default to be inserted */
  1287.         DBINT   cd_colen;               /* max length allowed in column */
  1288.         short   cd_coloff;              /* column offset in row */
  1289.         BYTE    cd_colid;               /* id of column */
  1290.         BYTE    cd_type;                /* storage type of column */
  1291.         BYTE    cd_status;              /* status bits */
  1292.         DBBOOL  cd_nullok;              /* is a NULL ok here? */
  1293.         char    cd_name[DBMAXNAME+1];   /* column name */
  1294.         DBBOOL  cd_moretext;            /* Is this text to be sent via bcp__moretext? */
  1295.         long    cd_textpos;             /* file-position of a long TEXT or IMAGE */
  1296. } BCPCOLDESC;
  1297.  
  1298. /*
  1299. **  BCPROWDESC
  1300. **      This is the basic unit of information used for bulkcopy.
  1301. **      All the bulkcopy routines that talk with the SQL Server
  1302. **      routines pass it.
  1303. */
  1304. typedef struct bcprowdesc
  1305. {
  1306.         BCPCOLDESC      *rd_coldesc;    /* ptr to base address of COLDESC
  1307.                                          * array
  1308.                                          */
  1309.         short           rd_colcount;    /* number of columns in COLDESC */
  1310.         short           rd_minlen;      /* minimum length of a row */
  1311.         short           rd_maxlen;      /* maximum length of a row */
  1312. } BCPROWDESC;
  1313.  
  1314. /*
  1315. ** BCPHOSTDESC
  1316. **      This is the structure that has information about the type and
  1317. **      format of the input or output data.  An array of these is used
  1318. **      to read/write data to or from the host.
  1319. */
  1320. typedef struct  bcphostdesc
  1321. {
  1322.         BCPCOLDESC      *h_tabcol; /* which table column we are referring to */
  1323.         int     h_tabcolnum;    /* which table column we are referring to */
  1324.         DBINT   (*hconvert)();  /* conversion function, if applicable */
  1325.         BYTE    htype;          /* host data type for this column */
  1326.         DBINT   hcollen;        /* max length of hostfile column */
  1327.         BYTE    *hdata;         /* host-format data for this column */
  1328.         DBINT   hdatlen;        /* length of actual hostfile data */
  1329.         BYTE    *hxdata;        /* This buffer holds the host-format data
  1330.                                  * after it has been translated from
  1331.                                  * one character-set to another.
  1332.                                  */
  1333.         DBINT   hxbuflen;       /* The length of the hxdata buffer. */
  1334.         DBINT   hxdatlen;       /* This is the length of the hostfile data,
  1335.                                  * after it has undergone any character-set
  1336.                                  * translation.
  1337.                                  */
  1338.         int     hprefixlen;     /* length of length-prefix for this column */
  1339.         BYTE    *hterm;         /* terminator for this column, if applicable */
  1340.         int     htermlen;       /* length of terminator for this column */
  1341.         DBBOOL  hmoretext;      /* Is this text to be sent via
  1342.                                  * bcp__moretext?
  1343.                                  */
  1344.         long    htextpos;       /* file-position of a long TEXT or IMAGE */
  1345. } BCPHOSTDESC;
  1346.  
  1347. /* This structure contains information about any partially-sent TEXT or IMAGE
  1348.  * values, which are still to be sent by bcp_moretext().
  1349.  */
  1350. typedef struct bcptextrec
  1351. {
  1352.         DBINT           len;
  1353.         BYTE            *val;
  1354.         BYTE            type;
  1355.         DBSMALLINT      rowoffset;
  1356.         BYTE            coloffset;
  1357. } BCPTEXTREC;
  1358.  
  1359. /*
  1360. **  BCPDESC
  1361. **      This structure is used to pass the information contained in the
  1362. **      Bulk Copy property sheet around (if in the form version), or 
  1363. **      information typed in by the user (in dblib/stand alone version).
  1364. **      In the form version, this information comes from the main form, while
  1365. **      in the stand alone version this comes from the command line.
  1366. */
  1367. typedef struct bcpdesc
  1368. {
  1369.         BCPROWDESC      *bd_rowdesc;            /* the associated rowdesc */
  1370.         BCPHOSTDESC     *bd_hostdesc;           /* ptr to base address of
  1371.                                                  * BCPHOSTDESC array
  1372.                                                  */
  1373.         DBXLATE         *bd_xlt_tosrv;          /* For use when transferring
  1374.                                                  * character strings from the
  1375.                                                  * front-end to the SQL Server
  1376.                                                  * (DB_IN).
  1377.                                                  */
  1378.         DBXLATE         *bd_xlt_todisp;         /* For use when transferring
  1379.                                                  * character strings from the
  1380.                                                  * SQL Server to the front-end
  1381.                                                  * (DB_OUT).
  1382.                                                  */
  1383.         int             bd_hcolcount;           /* number of (cols) BCPHOSTDESC 
  1384.                                                 ** structs */
  1385.         BCPPARSETABLE   *bd_ptable;             /* ptr to tbl name components
  1386.                                                  */
  1387.         char            bd_table[(3 * DBMAXNAME) + 3]; /* full table name */
  1388.         char            bd_filename[BCPNAMELEN+1];/* host filename */
  1389.         BYTE            bd_direction;           /* in/out */
  1390.         char            *bd_errfilename;        /* host err file name */
  1391.         BYTE            *bd_errfile;            /* host err file pointer */
  1392.         DBINT           bd_abort;               /* # of errors allowable */
  1393.         DBINT           bd_firstrow;            /* begin copy at this row */
  1394.         DBINT           bd_lastrow;             /* end copy at this row */
  1395.         DBINT           bd_batch;               /* # of rows per batch */
  1396.         int             bd_textcount;           /* # of text-columns in the
  1397.                                                  * current row.
  1398.                                                  */
  1399.         int             bd_textcol;             /* # of the text-column now
  1400.                                                  * being sent by bcp_moretext().
  1401.                                                  * Starts at zero.
  1402.                                                  */
  1403.         DBINT           bd_textbytes;           /* # of bytes already sent of
  1404.                                                  * the current bcp_moretext()
  1405.                                                  * column.
  1406.                                                  */
  1407.         BCPTEXTREC      *bd_textarray;
  1408. } BCPDESC;
  1409.  
  1410. /* Structures and constants for localization information: */
  1411.  
  1412. #define DBMAXMNYSYM     5       /* Max length of a currency symbol. */
  1413. #define DBMAXECLEN      8       /* Max length of a DB-Library error-number
  1414.                                  * mnemonic.
  1415.                                  */
  1416. #define DBMAXESLEN      256     /* Max length of a DB-Library error-string. */
  1417. #define DBMAXCPYRTLEN   512     /* Max length of a DB-Library copyright
  1418.                                  * notice.
  1419.                                  */
  1420.  
  1421. /* Each DBMNYFMT structure defines one of the acceptable money formats
  1422.  * for a given locale.
  1423.  */
  1424. typedef struct dbmnyfmt
  1425. {
  1426.         DBBOOL  symbol_first;           /* Should this currency symbol
  1427.                                          * appear before the currency
  1428.                                          * amount?
  1429.                                          */
  1430.         char    symbol[DBMAXMNYSYM+1]; /* The money-symbol itself. */
  1431.  
  1432.         struct dbmnyfmt         *next;
  1433. } DBMNYFMT;
  1434.  
  1435. /* Each DBERRSTR structure will define one of the DB-Library error codes
  1436.  * for a given locale.
  1437.  */
  1438. typedef struct dberrstr
  1439. {
  1440.         char    errcode[DBMAXECLEN+1];
  1441.                                         /* The short mnemonic string
  1442.                                          * which describes this error.
  1443.                                          */
  1444.         char    string[DBMAXESLEN+1];
  1445.                                                 /* The error-string itself. */
  1446. } DBERRSTR;
  1447.  
  1448. typedef struct dblocale
  1449. {
  1450.         char            name[DBMAXNAME+1]; /* This locale's name. */
  1451.         DBVOIDPTR       dateinfo;       /* All of the month-names,
  1452.                                          * day-names, and date-format
  1453.                                          * information for this locale.
  1454.                                          * This is defined as a void
  1455.                                          * pointer, to avoid exposing
  1456.                                          * the INTL_DATEINFO structure
  1457.                                          * to customers.
  1458.                                          */
  1459.         int             dateorder;      /* An integer code which describes
  1460.                                          * this locale's default date-order.
  1461.                                          * This code is used by datetime.c.
  1462.                                          */
  1463.         char            copyright[DBMAXCPYRTLEN];
  1464.                                         /* The copyright notice, in the
  1465.                                          * appropriate language.
  1466.                                          */
  1467.         DBMNYFMT        *moneyfmt;      /* A linked-list of money-format
  1468.                                          * structures.
  1469.                                          */
  1470.         DBERRSTR        errlist[DBERRCOUNT];
  1471.                                         /* An array of error-code
  1472.                                          * structures.
  1473.                                          */
  1474.         int             usecount;       /* How many DBPROCESSes are
  1475.                                          * using this localization
  1476.                                          * information? When the count
  1477.                                          * drops to zero, this whole
  1478.                                          * structure can be freed.
  1479.                                          */
  1480.         struct dblocale                 *next;
  1481. } DBLOCALE;
  1482.  
  1483.  
  1484. /*
  1485. ** 4.6 additions begin here.
  1486. */
  1487.  
  1488. /*
  1489. ** DBEVENTREC
  1490. **
  1491. ** This structure is used by dblibrary to keep track of event
  1492. ** notifications, event invocations, and all other event-related
  1493. ** activities.
  1494. */
  1495. typedef struct db__event_rec    {
  1496.         DBCHAR          name[DBMAXNAME+1];      /* event name */
  1497.         DBUSMALLINT     status;                 /* bit field */
  1498.         DBUSMALLINT     options;                /* notification flags */
  1499.         INTFUNCPTR      handler;                /* event handler */
  1500.         DBRETVAL        *params;                /* event parameters */
  1501.         DBSMALLINT      numparams;              /* how many params? */
  1502.         struct db__event_rec *next;             /* next event struct. */
  1503.         } DBEVENTREC;
  1504.  
  1505. /*
  1506. ** DBEVENTREC status bits.
  1507. */
  1508. #define DB__PENDING_NOTIFY      ((DBUSMALLINT)0x01)
  1509.  
  1510.  
  1511. /*
  1512. ** DBRPCREC
  1513. **
  1514. ** This structure is used by dblib to build a remote procedure call
  1515. ** data stream.
  1516. */
  1517. typedef struct db__rpc_rec      {
  1518.         DBCHAR          *name;                  /* rpc name */
  1519.         DBUSMALLINT     options;                /* bit options */
  1520.         DBRETVAL        *params;                /* list of params */
  1521.         DBSMALLINT      numparams;              /* how many params? */
  1522.         DBSMALLINT      textparams;             /* any text/image params? */
  1523.         DBSMALLINT      textsent;               /* how many text/image
  1524.                                                 ** parameters have been sent.
  1525.                                                 */
  1526.         DBUSMALLINT     status;                 /* bit field */
  1527.         } DBRPCREC;
  1528.  
  1529. /*
  1530. ** values for dbrpcrec->status.
  1531. */
  1532. #define DB__READ_END_OF_PARAM   ((DBUSMALLINT)0x0001)
  1533. #define DB__READ_ALL_PARAMS     ((DBUSMALLINT)0x0002)
  1534.  
  1535. /*
  1536. ** DBTRACEREC
  1537. **
  1538. ** This structure is used by dblib to store information regarding
  1539. ** Tabular Data Stream tracing.
  1540. */
  1541. typedef struct db__trace_rec    {
  1542.         DBUSMALLINT     trace_flag;             /* bit field */
  1543.         DBVOIDPTR       outfp;
  1544.         INTFUNCPTR      printfunc;              /* trace routine */
  1545.         struct db__trace_rec *next;
  1546.         } DBTRACEREC;
  1547.  
  1548.  /*
  1549. ** DBTRACEBUF
  1550. **
  1551. ** This structure is used to store trace information that will be
  1552. ** made available to the user via the dbtracestring() routine.
  1553. */
  1554. typedef struct db__tracebuf     {
  1555.         BYTE            *tbuf;
  1556.         DBSMALLINT      bufsize;
  1557.         BYTE            *next_byte;
  1558.         DBSMALLINT      bytes_left;
  1559.         } DBTRACEBUF;
  1560.  
  1561.  
  1562. /*
  1563. ** Trace flag symbols.
  1564. */
  1565. #define DBSTOPTRACE     ((DBUSMALLINT)0x0001)
  1566. #define DBTDSHEADER     ((DBUSMALLINT)0x0002)
  1567. #define DBTDSDATA       ((DBUSMALLINT)0x0004)
  1568. #define DBTDSATT        ((DBUSMALLINT)0x0008)
  1569. #define DBTDSCONNECT    ((DBUSMALLINT)0x0010)
  1570. #define DBTDSDUMP       ((DBUSMALLINT)0x0020)
  1571.  
  1572. /*
  1573. ** DB__TRACEBUF_SIZE - This is the size of the actual data buffer
  1574. ** that will be allocated by dbtraceon().
  1575. */
  1576. #define DB__TRACEBUF_SIZE       3000
  1577.  
  1578.   
  1579. /*
  1580. ** DBLOGINFO - A structure used by TDS passthru login routines
  1581. ** to communicate login parameters between Open Client and OpenServer.
  1582. */
  1583. typedef struct dbloginfo
  1584. {
  1585.         BYTE    tds_level[4];           /* The version of TDS to be used. */
  1586.         DBINT   packet_size;            /* The TDS packet size to be used. */
  1587.         BYTE    flt8_type;              /* Type of SYBFLT8 on this
  1588.                                         ** platform.
  1589.                                         */
  1590.         BYTE    flt4_type;              /* Type of SYBREAL on this
  1591.                                         ** platform.
  1592.                                         */
  1593.         BYTE    int4_type;              /* Type of SYBINT4 on this
  1594.                                         ** platform.
  1595.                                         */
  1596.         BYTE    int2_type;              /* Type of SYBINT2 on this
  1597.                                         ** platform.
  1598.                                         */
  1599.         BYTE    date_type;              /* Type of SYBDATETIME on
  1600.                                         ** this platform.
  1601.                                         */
  1602.         BYTE    char_type;              /* Type of SYBCHAR on this
  1603.                                         ** platform.
  1604.                                         */
  1605.         BYTE    noshort;                /* Whether to convert short
  1606.                                         ** data types to long values.
  1607.                                         */
  1608.         BYTE    language[MAXNAME];      /* The name of the language to
  1609.                                         ** be used for this session.
  1610.                                         */
  1611.         BYTE    langlen;                /* The length of language[] */
  1612.         BYTE    setlang;                /* Whether the language field
  1613.                                         ** contains a real value.
  1614.                                         */
  1615.         BYTE    charset[MAXNAME];       /* The name of the charset to
  1616.                                         ** be used for this session.
  1617.                                         */
  1618.         BYTE    charsetlen;             /* The length of charset[] */
  1619.         BYTE    setcharset;             /* Whether the charset field
  1620.                                         ** contains a real value.
  1621.                                         */
  1622.         BYTE    ldmpld;                 /* Dump/load indicator. */
  1623. } DBLOGINFO;
  1624.  
  1625.  
  1626. /*
  1627. ** DBCHARSET
  1628. **
  1629. ** This structure is used to hold character set specific information.
  1630. ** More than one dbproc may reference a given DBCHARSET record, so a 
  1631. ** use count is maintained so we know when we can free the structure.
  1632. */
  1633. typedef struct dbcharset
  1634. {
  1635.         char    name[DBMAXNAME+1];      /* Name of the character set
  1636.                                         ** (null-terminated)
  1637.                                         */
  1638.         DBSMALLINT      type;           /* Type of the character set */
  1639.         DBTINYINT       id;             /* Character set id */
  1640.         void            *char_data;     /* Pointer to image data from 
  1641.                                         ** Server. May be NULL.
  1642.                                         */
  1643.         void            *chatr;         /* Pointer to structure which provides 
  1644.                                         ** meaning to data pointed to by 
  1645.                                         ** char_data. This structure is filled 
  1646.                                         ** in by the function 
  1647.                                         ** build_char_attrib(). Both the 
  1648.                                         ** structure declaration and the 
  1649.                                         ** function are provided by the
  1650.                                         ** Server group.
  1651.                                         */
  1652.         int     usecount;               /* Number of DBPROCESSes using this
  1653.                                         ** character set.
  1654.                                         */
  1655.         struct dbcharset *next;         /* Next structure in linked list.
  1656.                                         */
  1657. } DBCHARSET;
  1658.  
  1659.  
  1660. /*
  1661. **  DBPROCESS - This is the basic DBLIB structure. It contains the command
  1662. **      sent to the dataserver as well as the results of the command.
  1663. **      It also includes any error or information messages, including the
  1664. **      done packet, returned by the dataserver.  If buffering is turned on,
  1665. **      this structure also stores the data rows.
  1666. */
  1667. struct dbprocess
  1668. {
  1669.         struct servbuf  *dbfile;        /* dataserver connection */
  1670.         DBINT         dbstatus;       /* status field for dbprocess */
  1671.         BYTE            dbtoken;        /* current dataserver token */
  1672.         DBSTRING        *dbcmdbuf;      /* command buffer */
  1673.         int             dbcurcmd;       /* number of the current cmd results */
  1674.         DBINT           dbprocid;       /* procid, if any, of the current cmd */
  1675.         DBCOLINFO       *dbcols;        /* linked list of column information */
  1676.         DBALTHEAD       *dbalts;        /* linked list of alt column info */
  1677.         DBROW           *dbfirstdata;   /* doubly linked list of returned row
  1678.                                          * data
  1679.                                          */
  1680.         DBROW           *dbcurdata;     /* current row in dbfirstdata */
  1681.         DBROW           *dblastdata;    /* last row in dbfirstdata, usually
  1682.                                          * dbcurdata
  1683.                                          */
  1684.         DBOFF           *dboffsets;     /* list of offsets and controls in
  1685.                                          * dbcmdbuf
  1686.                                          */
  1687.         int             dboffadjust;    /* adjustment factor for offsets */
  1688.         DBSMALLINT      dbcuroffset;    /* active offset for results */
  1689.         DBOPTION        *dbopts;
  1690.         DBSTRING        *dboptcmd;      /* option string to send to server */
  1691.         DBINFO          *dbmsgs;        /* linked list of info and error
  1692.                                          * messages
  1693.                                          */
  1694.         DBINFO          *dbcurmsg;      /* last message read by dbgetmsg() */
  1695.         DBDONE          dbdone;         /* done information */
  1696.         char            dbcurdb[DBMAXNAME+1];   /* the name of the current
  1697.                                                  * database
  1698.                                                  */
  1699.         int             (*(*dbbusy)())(); /* function to call when waiting on
  1700.                                            * dataserver
  1701.                                            */
  1702.         void            (*dbidle)();    /* function to call when waiting on
  1703.                                          * dataserver
  1704.                                          */
  1705.         int             (*dbchkintr)(); /* user's function to call to check for
  1706.                                          * queued interrupts
  1707.                                          */
  1708.         int             (*dbhndlintr)();/* user's interrupt handler */
  1709.         int             dbbufsize;      /* the size of the row buffer, if
  1710.                                          * enabled
  1711.                                          */
  1712.         NULLBIND        dbnullbind;     /* what to bind for nulls */
  1713.         int             dbsticky;       /* sticky flags like attn */
  1714.         int             dbnumorders;    /* number of columns in the query's
  1715.                                          * "order by" clause.
  1716.                                          */
  1717.         int             *dbordercols;   /* array of the column numbers found in
  1718.                                          * the query's "order by" clause.
  1719.                                          */
  1720.         DBBOOL          dbavail;        /* is this dbproc available for general
  1721.                                          * use?
  1722.                                          */
  1723.         int             dbftosnum;      /* this id is used when recording the
  1724.                                          * frontend-to-Server SQL traffic of
  1725.                                          * this DBPROCESS.
  1726.                                          */
  1727.         DBBOOL          dbdead;         /* TRUE if this DBPROCESS has become
  1728.                                          * useless, usually due to a fatal
  1729.                                          * Server error, or a communications
  1730.                                          * failure.
  1731.                                          */
  1732.         DBBOOL          dbenabled;      /* TRUE if this DBPROCESS is allowed to
  1733.                                          * be used in DB-LIBRARY functions. The
  1734.                                          * user may set this flag FALSE,
  1735.                                          * possibly within an error handler, if
  1736.                                          * execution of further commands would
  1737.                                          * just cause further errors.
  1738.                                          * DB-LIBRARY initially sets this flag
  1739.                                          * TRUE. The user may set and re-set
  1740.                                          * this flag at will.
  1741.                                          */
  1742.         DBBOOL          dbsqlsent;      /* TRUE if the SQL in the command
  1743.                                          * buffer has already been sent to
  1744.                                          * the SQL Server.
  1745.                                          */
  1746.         DBTABNAME       *dbtabnames;    /* linked-list of table-name
  1747.                                          * information used by "browse mode".
  1748.                                          */
  1749.         DBINT           dbspid;         /* The Server process-id of this
  1750.                                          * DBPROCESS. It's returned in the
  1751.                                          * row-count field of the done-packet
  1752.                                          * which signifies a successful login.
  1753.                                          */
  1754.         DBRETVAL        *dbretvals;     /* linked-list of function
  1755.                                          * return-values.
  1756.                                          */
  1757.         BCPDESC         *db_bcpdesc;    /* A structure containing bulk-copy
  1758.                                          * information.
  1759.                                          */
  1760.         DBBOOL          dbtransbegun;   /* Indicates that a text data transfer
  1761.                                          * is under way.
  1762.                                          */
  1763.         DBINT           dbbytesleft;    /* This is a countdown variable, used
  1764.                                          * to track the number of bytes which
  1765.                                          * are still to be sent as part of
  1766.                                          * a dbwritetext() command.  Or, in
  1767.                                          * dbreadtext() as the number still
  1768.                                          * to read on the net.
  1769.                                          */
  1770.         DBINT           dbretstat;      /* This is the return-status from
  1771.                                          * a stored procedure.
  1772.                                          */
  1773.         DBBOOL          dbhasretstat;   /* Is the return-status valid? */
  1774.         DBINT           dbtextlimit;    /* This is the longest text-column
  1775.                                          * that this dbproc will accept
  1776.                                          * from the Server. Any additional
  1777.                                          * bytes will be discarded.
  1778.                                          * If 0, then there's no limit.
  1779.                                          */
  1780.         BYTE            *dbuserdata;    /* A pointer to any data that the
  1781.                                          * the user wishes to associate with
  1782.                                          * this DBPROCESS.
  1783.                                          */
  1784.         DBINT           dbmsgno;        /* The number of the Server message
  1785.                                          */
  1786.         char            dblogin_node[DBMAXNAME + 1];
  1787.                                         /* The node that the Companion
  1788.                                          * Server's redirector has
  1789.                                          * recommended to us.
  1790.                                          */
  1791.         int             dbcolcount;     /* The number of regular columns
  1792.                                          * in the current set of results.
  1793.                                          */
  1794.  
  1795.         DBBOOL          db_oldtds;      /* TRUE if the TDS version is older
  1796.                                          * than 4.0.
  1797.                                          */
  1798.         int             db_tdsversion;  /* tds version for this dbproc. */
  1799.  
  1800.         DBLOCALE        *dblocale;      /* The localization info for this
  1801.                                          * DBPROCESS.
  1802.                                          */
  1803.         DBVOIDPTR       rowfile;        /* The file-pointer used by
  1804.                                          * dbprrow().
  1805.                                          */
  1806.         DBINT           dbsprlen;       /* The current length of a string
  1807.                                          * being built up by one of the
  1808.                                          * dbspr* functions.
  1809.                                          */
  1810.         DBINT           dbsprmaxlen;    /* The maximum length of a buffer
  1811.                                          * being filled by one of the dbspr*
  1812.                                          * functions.
  1813.                                          */
  1814.         char            *dbsprnextchar; /* The next available character
  1815.                                          * of a buffer being filled by one of
  1816.                                          * the dbspr* functions.
  1817.                                          */
  1818.         int             dbprlinelen;    /* The length of a display line.
  1819.                                          * This information is used by
  1820.                                          * the dbspr* functions.
  1821.                                          */
  1822. #if VMS
  1823.         int             db_event_mask;  /* a mask used to determine what
  1824.                                         ** event has happened in the front-
  1825.                                         ** end i/o routines.
  1826.                                         */
  1827.         long            db_event_flag;  /* the number of the event flag used
  1828.                                         ** to check for timeout, interrupt 
  1829.                                         ** (control_c) or i/o completion.
  1830.                                         */
  1831.         short           db_io_channel;  /* channel assigned to sys$command
  1832.                                         ** of the controlling process.
  1833.                                         */
  1834.         short           r_iosb[4];      /* I/O status for read */
  1835.         short           w_iosb[4];      /* I/O status for write */
  1836.  
  1837.         /* for async event notifications */
  1838.         long            db_readflags;   /* flags used for buffer and QIO
  1839.                                         ** synchronization */
  1840.         long            db_recvfl_ast;  /* async recvfill_a original ast */
  1841.         long            db_recvfl_astp; /* async recvfill_a original astp */
  1842.         long            db_recvfl_fr;   /* async recvfill_a original final_result */
  1843.         long            db_rp_fr;       /* pending readfill_a final_result */
  1844.         void            *dbpoll_ast;    /* Structure containing information
  1845.                                         ** needed during asynchronous dbpoll().
  1846.                                         */
  1847. #endif /* VMS */
  1848.         DBRPCREC        *db_rpcrec;     /* rpc record */
  1849.         DBVOIDPTR       db_events;      /* table of event structs */
  1850.         DBEVENTREC      *db_curevent;   /* the current event */
  1851.         DBEVENTREC      *db_defeventrec; /* the default eventrec */
  1852.         DBCHAR          *db_waitevent;  /* the name of the event being waited
  1853.                                         ** for synchronously. This field is
  1854.                                         ** only valid if dbstatus has the
  1855.                                         ** DB_INLINENOTIFY bit is set.
  1856.                                         */
  1857.         DBUSMALLINT     db_traceflags;  /* active traces */
  1858.         DBTRACEREC      *db_tracerec;   /* trace structure */
  1859.         DBTRACEBUF      *db_tracebuf;   /* the trace data itself */
  1860.         DBINT           db_traceid;     /* the id of this dbproc. */
  1861.         BYTE            db__priv[8];
  1862.         DBBOOL          first_token_read;
  1863.                                         /* This field is set when
  1864.                                          * the first token of a server
  1865.                                          * response has been read by
  1866.                                          * dbpoll().
  1867.                                          */
  1868.         DBINT           db_packetsize;  /* The packet size being used by 
  1869.                                         ** this DBPROCESS.
  1870.                                         */
  1871.         DBBOOL          use_logintime;  /* If this field is set TRUE,
  1872.                                          * it indicates that this
  1873.                                          * DBPROCESS should use the
  1874.                                          * DbLoginSecs timeout value,
  1875.                                          * instead of the usual DbTimeout.
  1876.                                          */
  1877.         DBBOOL          dbuse_in_progress;
  1878.                                         /* If this field is set TRUE,
  1879.                                          * it indicates that this DBPROCESS
  1880.                                          * is in the middle of a dbuse()
  1881.                                          * operation, and should use the
  1882.                                          * dbuse() error- and message-handlers.
  1883.                                          */
  1884.         DBBOOL          textok_in_progress;
  1885.                                         /* If this field is set TRUE,
  1886.                                          * it indicates that this DBPROCESS
  1887.                                          * is in the middle of a db__textok()
  1888.                                          * operation, and should use the
  1889.                                          * db__textok() error- and
  1890.                                          * message-handlers.
  1891.                                          */
  1892.         DBBOOL          textok;         /* This field indicates whether
  1893.                                          * or not the server which is
  1894.                                          * connected to this DBPROCESS
  1895.                                          * can handle TEXT and IMAGE data.
  1896.                                          */
  1897.         DBBOOL          recovering;     /* If this field is set TRUE, it
  1898.                                          * indicates that a dbuse() operation
  1899.                                          * is continuing to attempt to
  1900.                                          * access a database which is
  1901.                                          * still recovering.
  1902.                                          */
  1903.         char            servcharset[DBMAXNAME+1];
  1904.                                         /* The name of the server's character 
  1905.                                         ** set.
  1906.                                         */
  1907.         char            charset[DBMAXNAME+1];
  1908.                                         /* The name of the character set
  1909.                                         ** currently in use.
  1910.                                         */
  1911.         DBCHARSET       *charset_info;  /* Pointer to information about the
  1912.                                         ** current character set.
  1913.                                         */
  1914.         DBBOOL          charset_cnv;    /* Indicates whether the server
  1915.                                         ** can convert from/to its character
  1916.                                         ** set to the Clients character set.
  1917.                                         ** TRUE means the conversion is being
  1918.                                         ** done.
  1919.                                         */
  1920.         DBBOOL          need_charset_info;
  1921.                                         /* Indicates whether we need to
  1922.                                         ** load character set info from the
  1923.                                         ** Server.
  1924.                                         */
  1925.         DBUSMALLINT     envchange_rcv;  /* Bit mask indicating whether 
  1926.                                         ** TDS ENVCHANGE packets were received.
  1927.                                         */
  1928.     DBROWDATA    *db_readtext;    /* Place to hold text timestamp and
  1929.                     ** text pointer when reading text
  1930.                     ** rows via dbreadtext().
  1931.                     */
  1932.     DBINT        requested_packetsize;
  1933.                     /* packet size requested
  1934.                     ** by user via DBSETLPACKET().
  1935.                     */
  1936.         struct dbprocess        *dbnext;/* DBPROCESSes are kept track of
  1937.                                          * in a big linked-list.
  1938.                                          */
  1939. };
  1940. typedef struct dbprocess        DBPROCESS;
  1941.  
  1942. #define DBTDS_UNKNOWN           0
  1943. #define DBTDS_2_0               1       /* used by pre 4.0 SQL Server */
  1944. #define DBTDS_3_4               2       /* used by Microsoft SQL Server (3.0) */
  1945. #define DBTDS_4_0               3       /* used by 4.0 SQL Server */
  1946. #define DBTDS_4_2               4       /* used by 4.2 SQL Server */
  1947. #define DBTDS_4_6               5       /* used by 2.0 OpenServer and
  1948.                                         ** 4.6 SQL Server.
  1949.                                         */
  1950. /*
  1951. ** Possible values for the envchange_rcv field.
  1952. */
  1953. #define DB__DB_ENVCHANGE        ((DBUSMALLINT) 0x0001)
  1954. #define DB__LANG_ENVCHANGE      ((DBUSMALLINT) 0x0002)
  1955. #define DB__CHAR_ENVCHANGE      ((DBUSMALLINT) 0x0004)
  1956. #define DB__PACKET_ENVCHANGE    ((DBUSMALLINT) 0x0008)
  1957.  
  1958.  
  1959. /*
  1960. **  Various macros used to extract information from the DBPROCESS structure
  1961. */
  1962. #define DBTDS(a)                dbtds(a)
  1963. #define DBCURCMD(a)             dbcurcmd(a)
  1964. #define DBCURROW(a)             dbcurrow(a)
  1965. #define DBFIRSTROW(a)           dbfirstrow(a)
  1966. #define DBLASTROW(a)            dblastrow(a)
  1967. #define DBROWTYPE(a)            dbrowtype(a)
  1968. #define DBMORECMDS(a)           dbmorecmds(a)
  1969. #define DONECONTINUE(a)         donecontinue(a)
  1970. #define DBCOUNT(a)              dbcount(a)
  1971. #define DBCMDROW(x)             dbcmdrow(x)
  1972. #define DBROWS(x)               dbrows(x)
  1973. #define DBNUMORDERS(a)          dbnumorders(a)
  1974. #define DBBUFFULL(a)            dbbuffull(a)
  1975. #define DBMOREROWS(a)           dbmorerows(a)
  1976. #define DBISAVAIL(a)            dbisavail(a)
  1977. #define DBDEAD(a)               dbdead(a)
  1978. #define DBIORDESC(a)            dbiordesc(a)
  1979. #define DBIOWDESC(a)            dbiowdesc(a)
  1980. #define DBRBUF(a)               dbrbuf(a)
  1981. #define DBGETTIMEOUT(a)         db__getDbTimeout(a)
  1982. #define DBGETTIME()             db__getDbTimeout((DBPROCESS *)0)
  1983.  
  1984.  
  1985. #if (VMS)
  1986. #define DBZEROSPACE(dest, bytes)                db__bzero(dest, bytes)
  1987. #else
  1988. #define DBZEROSPACE(dest, bytes)                MEMZERO(dest, bytes)
  1989. #endif /* (VMS) */
  1990.  
  1991. /*
  1992. ** These constants are used for RPC options.
  1993. */
  1994. #define DBRPCRECOMPILE  ((DBUSMALLINT)0x0001)
  1995. #define DBNOTIFYALL     ((DBUSMALLINT)0x0002)
  1996. #define DBNOTIFYNEXT    ((DBUSMALLINT)0x0004)
  1997.  
  1998. /*
  1999. ** These constants are used for RPC parameter status values.
  2000. */
  2001. #define DBRPCNORETURN   ((BYTE)0)
  2002. #define DBRPCRETURN     ((BYTE)1)
  2003. #define DB__NODEFAULT   ((BYTE)2)
  2004.  
  2005. /*
  2006. ** This constant is used in dbregparam() to define
  2007. ** a parameter that has no default data value.
  2008. */
  2009. #define DBNODEFAULT   ((DBINT)-2)
  2010.  
  2011.  
  2012. /*
  2013. ** dbgetlusername() will return DBTRUNCATED if it truncated the user name.
  2014. */
  2015. #define DBTRUNCATED     -1
  2016.  
  2017. /*
  2018. ** Internal Remote procedure call names used by Event Manager.
  2019. ** These names must match the names used by Open/SQL Server.
  2020. */
  2021.  
  2022. #define DB__EVENTNOTIFY_RPC     "sp_regwatch"
  2023. #define DB__CANCELNOTIFY_RPC    "sp_regnowatch"
  2024. #define DB__ADD_EVENT_RPC       "sp_regcreate"
  2025. #define DB__DROPEVENT_RPC       "sp_regdrop"
  2026. #define DB__EVENTLIST_RPC       "sp_reglist"
  2027. #define DB__NOTIFYLIST_RPC      "sp_regwatchlist"
  2028.  
  2029.  
  2030. /*
  2031. ** Define the legal values for the dbregwatch() options parameter.
  2032. ** These may be OR-able symbols.
  2033. */
  2034. #define DBNOTIFYONCE    ((DBUSMALLINT)0x0002)
  2035. #define DBNOTIFYALWAYS  ((DBUSMALLINT)0x0004)
  2036. #define DBSYNC          ((DBUSMALLINT)0x0020)
  2037. #define DBASYNC         ((DBUSMALLINT)0x0040)
  2038.  
  2039. #define DBWAIT          ((DBUSMALLINT)0x0022)
  2040. #define DBNOWAITONE     ((DBUSMALLINT)0x0042)
  2041. #define DBNOWAITALL     ((DBUSMALLINT)0x0044)
  2042.  
  2043.  
  2044. /*
  2045. ** new function return codes.
  2046. */
  2047. #define DB_PASSTHRU_MORE        ((RETCODE)1)
  2048. #define DB_PASSTHRU_EOM         ((RETCODE)2)
  2049. #define DBNOPROC                ((RETCODE)2)
  2050.  
  2051.  
  2052. /*
  2053. ** definition of a TDS packet size.
  2054. */
  2055. #define DB__PACKET_SIZE         ((DBINT)512)
  2056. #define DB__MIN_PACKET_SIZE     ((DBINT)256)
  2057. #define DB__MAX_PACKET_SIZE     ((DBINT)9999)
  2058.  
  2059. #if VMS
  2060. /* These constants are used for VMS network manipulation. */
  2061. #define DB_IO_EVENT     1
  2062. #define DB_INTERRUPT_EVENT 2
  2063. #define DB_TIMER_EVENT  4
  2064. #endif /* VMS */
  2065.  
  2066. /*
  2067. ** Macros to set values in the LOGINREC structure.
  2068. */
  2069. #define DBSETHOST       1
  2070. #define DBSETUSER       2
  2071. #define DBSETPWD        3
  2072. #define DBSETHID        4
  2073. #define DBSETAPP        5
  2074. #define DBSETBCP        6
  2075. #define DBSETNATLANG    7
  2076. #define DBSETNOSHORT    8
  2077. #define DBSETHIER       9
  2078. #define DBSETCHARSET    10
  2079. #define DBSETPACKET     11
  2080. #define DBSETLHOST(a,b)         dbsetlname((a), (b), DBSETHOST)
  2081. #define DBSETLUSER(a,b)         dbsetlname((a), (b), DBSETUSER)
  2082. #define DBSETLPWD(a,b)          dbsetlname((a), (b), DBSETPWD)
  2083. #define DBSETLHID(a,b)          dbsetlname((a), (b), DBSETHID)
  2084. #define DBSETLAPP(a,b)          dbsetlname((a), (b), DBSETAPP)
  2085. #define DBSETLNATLANG(a,b)      dbsetlname((a), (b), DBSETNATLANG)
  2086. #define DBSETLNOSHORT(a,b)      dbsetlbool((a), (b), DBSETNOSHORT)
  2087. #define DBSETLHIER(a,b)         dbsetlshort((a), (b), DBSETHIER)
  2088. #define DBGETLHIER(a)           dbgetlhier(a)
  2089. #define DBSETLROLE(a,b)         dbsetlrole(a,b)
  2090. #define DBSETLCOMP(a,b)         dbsetlcomp(a,b)
  2091. #define DBSETLPACKET(a,b)       dbsetllong((a), (b), DBSETPACKET)
  2092. #define DBSETLCHARSET(a,b)      dbsetlname((a), (b), DBSETCHARSET)
  2093. #define DBSETONECOMP(a,b)       (a)[ ((b)-1)/8 ] |= ( 0x80 >> (( (b)-1 ) % 8) )
  2094.  
  2095. #ifndef COMPILE_STYLE
  2096. #define COMPILE_STYLE KR_C_COMPILE
  2097. #endif
  2098.  
  2099. #ifndef TYPE_TOKEN_1
  2100. #define TYPE_TOKEN_1
  2101. #endif
  2102. #ifndef TYPE_TOKEN_2
  2103. #define TYPE_TOKEN_2
  2104. #endif
  2105.  
  2106. #if ((COMPILE_STYLE == ANSI_C_COMPILE) || (COMPILE_STYLE == CPP_COMPILE))
  2107.  
  2108. /* This may eventually need to be moved up earlier in the file: */
  2109. #ifndef FILE
  2110. #include <stdio.h>
  2111. #endif
  2112.  
  2113. /* bcp functions */
  2114. extern TYPE_TOKEN_1 DBBOOL      TYPE_TOKEN_2    bcp_getl(LOGINREC *);
  2115. extern TYPE_TOKEN_1 BCPDESC     TYPE_TOKEN_2    *bcpinit(LOGINREC
  2116. *,char *,char *,char *,BYTE);
  2117. extern TYPE_TOKEN_1 RETCODE     TYPE_TOKEN_2    bcpcontrol(BCPDESC
  2118. *,int,BYTE *);
  2119. extern TYPE_TOKEN_1 RETCODE     TYPE_TOKEN_2    bcpcolumn(BCPDESC *,int);
  2120. extern TYPE_TOKEN_1 RETCODE     TYPE_TOKEN_2    bcpformat(BCPDESC
  2121. *,int,int,char *,BYTE,int);
  2122. extern TYPE_TOKEN_1 RETCODE     TYPE_TOKEN_2    bcpexec(BCPDESC *,DBINT *);
  2123. extern TYPE_TOKEN_1 RETCODE     TYPE_TOKEN_2    bcpbind(BCPDESC *,BYTE
  2124. *,int,char *,int,int);
  2125. extern TYPE_TOKEN_1 RETCODE     TYPE_TOKEN_2    bcpsendrow(BCPDESC *);
  2126. extern TYPE_TOKEN_1 RETCODE     TYPE_TOKEN_2    bcpabort(BCPDESC *);
  2127. extern TYPE_TOKEN_1 RETCODE     TYPE_TOKEN_2    bcpcollen(BCPDESC *,int,int);
  2128. extern TYPE_TOKEN_1 DBINT       TYPE_TOKEN_2    bcpdone(BCPDESC *);
  2129.                                 
  2130. /*
  2131. ** external declaration for functions referenced in this file as macros 
  2132. ** and were once macros
  2133. */
  2134. extern TYPE_TOKEN_1 BYTE        TYPE_TOKEN_2    bcp_hosttype(DBPROCESS *,int);
  2135. extern TYPE_TOKEN_1 int         TYPE_TOKEN_2    dbtds(DBPROCESS *);
  2136. extern TYPE_TOKEN_1 int         TYPE_TOKEN_2    dbcurcmd(DBPROCESS *);
  2137. extern TYPE_TOKEN_1 DBINT       TYPE_TOKEN_2    dbcurrow(DBPROCESS *);
  2138. extern TYPE_TOKEN_1 DBINT       TYPE_TOKEN_2    dbfirstrow(DBPROCESS *);
  2139. extern TYPE_TOKEN_1 DBINT       TYPE_TOKEN_2    dblastrow(DBPROCESS *);
  2140. extern TYPE_TOKEN_1 DBINT       TYPE_TOKEN_2    dbrowtype(DBPROCESS *);
  2141. extern TYPE_TOKEN_1 DBINT       TYPE_TOKEN_2    dbmorecmds(DBPROCESS *);
  2142. extern TYPE_TOKEN_1 DBINT       TYPE_TOKEN_2    donecontinue(DBPROCESS *);
  2143. extern TYPE_TOKEN_1 DBINT       TYPE_TOKEN_2    dbcount(DBPROCESS *);
  2144. extern TYPE_TOKEN_1 DBINT       TYPE_TOKEN_2    dbcmdrow(DBPROCESS *);
  2145. extern TYPE_TOKEN_1 DBINT       TYPE_TOKEN_2    dbrows(DBPROCESS *);
  2146. extern TYPE_TOKEN_1 int         TYPE_TOKEN_2    dbnumorders(DBPROCESS *);
  2147. extern TYPE_TOKEN_1 DBBOOL      TYPE_TOKEN_2    dbbuffull(DBPROCESS *);
  2148. extern TYPE_TOKEN_1 DBBOOL      TYPE_TOKEN_2    dbmorerows(DBPROCESS *);
  2149. extern TYPE_TOKEN_1 DBBOOL      TYPE_TOKEN_2    dbisavail(DBPROCESS *);
  2150. extern TYPE_TOKEN_1 DBBOOL      TYPE_TOKEN_2    dbdead(DBPROCESS *);
  2151. extern TYPE_TOKEN_1 int         TYPE_TOKEN_2    dbiordesc(DBPROCESS *);
  2152. extern TYPE_TOKEN_1 int         TYPE_TOKEN_2    dbiowdesc(DBPROCESS *);
  2153. extern TYPE_TOKEN_1 DBBOOL      TYPE_TOKEN_2    dbrbuf(DBPROCESS *);
  2154. extern TYPE_TOKEN_1 short       TYPE_TOKEN_2    dbgetlhier(LOGINREC *);
  2155. extern TYPE_TOKEN_1 VOID        TYPE_TOKEN_2    dbsetlrole(LOGINREC *,int);
  2156. extern TYPE_TOKEN_1 int         TYPE_TOKEN_2    dbsetlcomp(LOGINREC *,BYTE *);
  2157.  
  2158. /* Forward declarations of DB-LIBRARY routines */
  2159.  
  2160. extern TYPE_TOKEN_1 DBINT       TYPE_TOKEN_2    bcp_batch(DBPROCESS *);
  2161. extern TYPE_TOKEN_1 RETCODE     TYPE_TOKEN_2    bcp_bind(DBPROCESS
  2162. *,BYTE *,int,DBINT,BYTE *,int,int,int);
  2163. extern TYPE_TOKEN_1 RETCODE     TYPE_TOKEN_2    bcp_colfmt(DBPROCESS
  2164. *,int,int,int,DBINT,BYTE *,int,int);
  2165. extern TYPE_TOKEN_1 RETCODE     TYPE_TOKEN_2    bcp_collen(DBPROCESS
  2166. *,DBINT,int);
  2167. extern TYPE_TOKEN_1 RETCODE     TYPE_TOKEN_2    bcp_colptr(DBPROCESS
  2168. *,BYTE *,int);
  2169. extern TYPE_TOKEN_1 RETCODE     TYPE_TOKEN_2    bcp_columns(DBPROCESS *,int);
  2170. extern TYPE_TOKEN_1 RETCODE TYPE_TOKEN_2 bcp_control(DBPROCESS *,int,DBINT);
  2171. extern TYPE_TOKEN_1 DBINT       TYPE_TOKEN_2    bcp_done(DBPROCESS *);
  2172. extern TYPE_TOKEN_1 RETCODE     TYPE_TOKEN_2    bcp_exec(DBPROCESS *,DBINT
  2173. *);
  2174. extern TYPE_TOKEN_1 RETCODE     TYPE_TOKEN_2    bcp_init(DBPROCESS
  2175. *,char *,char *,char *,int);
  2176. extern TYPE_TOKEN_1 RETCODE     TYPE_TOKEN_2    bcp_moretext(DBPROCESS
  2177. *,DBINT,BYTE *);
  2178. extern TYPE_TOKEN_1 RETCODE    TYPE_TOKEN_2    bcp_readfmt(DBPROCESS *,
  2179. char *);
  2180. extern TYPE_TOKEN_1 RETCODE     TYPE_TOKEN_2    bcp_sendrow(DBPROCESS *);
  2181. extern TYPE_TOKEN_1 RETCODE    TYPE_TOKEN_2    bcp_setxlate(DBPROCESS
  2182. *,DBXLATE *,DBXLATE *);
  2183. extern TYPE_TOKEN_1 RETCODE    TYPE_TOKEN_2    bcp_writefmt(DBPROCESS
  2184. *,char *);
  2185.  
  2186. extern TYPE_TOKEN_1 DBPROCESS   TYPE_TOKEN_2    *open_commit(LOGINREC *,char *);
  2187. extern TYPE_TOKEN_1 void        TYPE_TOKEN_2    close_commit(DBPROCESS *);
  2188. extern TYPE_TOKEN_1 void        TYPE_TOKEN_2    build_xact_string(char
  2189. *,char *,DBINT,char *);
  2190. extern TYPE_TOKEN_1 DBINT       TYPE_TOKEN_2    start_xact(DBPROCESS
  2191. *,char *,char *,int);
  2192. extern TYPE_TOKEN_1 RETCODE     TYPE_TOKEN_2    commit_xact(DBPROCESS
  2193. *,DBINT);
  2194. extern TYPE_TOKEN_1 RETCODE     TYPE_TOKEN_2    abort_xact(DBPROCESS
  2195. *,DBINT);
  2196. extern TYPE_TOKEN_1 RETCODE     TYPE_TOKEN_2    remove_xact(DBPROCESS
  2197. *,DBINT,int);
  2198. extern TYPE_TOKEN_1 RETCODE     TYPE_TOKEN_2    scan_xact(DBPROCESS *,DBINT);
  2199. extern TYPE_TOKEN_1 int         TYPE_TOKEN_2    stat_xact(DBPROCESS *,DBINT);
  2200.  
  2201. extern TYPE_TOKEN_1 int         TYPE_TOKEN_2    dbaltutype(DBPROCESS *,int,int);
  2202. extern TYPE_TOKEN_1 RETCODE     TYPE_TOKEN_2    dbbind(DBPROCESS
  2203. *,int,int,DBINT,BYTE *);
  2204. extern TYPE_TOKEN_1 DBINT    TYPE_TOKEN_2    dbconvert(DBPROCESS 
  2205. *,int,BYTE *,DBINT,int,BYTE *,DBINT);
  2206. extern TYPE_TOKEN_1 DBBOOL    TYPE_TOKEN_2    dbwillconvert(int,int);
  2207. extern TYPE_TOKEN_1 RETCODE     TYPE_TOKEN_2    dbnullbind(DBPROCESS
  2208. *,int,DBINT *);
  2209. extern TYPE_TOKEN_1 RETCODE     TYPE_TOKEN_2    dbaltbind(DBPROCESS
  2210. *,int,int,int,DBINT,BYTE *);
  2211. extern TYPE_TOKEN_1 RETCODE     TYPE_TOKEN_2    dbanullbind(DBPROCESS
  2212. *,int,int,DBINT *);
  2213. extern TYPE_TOKEN_1 DBBOOL      TYPE_TOKEN_2    dbcolbrowse(DBPROCESS *,int);
  2214. extern TYPE_TOKEN_1 DBBOOL      TYPE_TOKEN_2    dbtabbrowse(DBPROCESS *,int);
  2215. extern TYPE_TOKEN_1 char    TYPE_TOKEN_2   *dbtabsource(DBPROCESS *,int,int *);
  2216. extern TYPE_TOKEN_1 DBBINARY    TYPE_TOKEN_2    *dbtsnewval(DBPROCESS *);
  2217. extern TYPE_TOKEN_1 int         TYPE_TOKEN_2    dbtsnewlen(DBPROCESS *);
  2218. extern TYPE_TOKEN_1 int         TYPE_TOKEN_2    dbtabcount(DBPROCESS *);
  2219. extern TYPE_TOKEN_1 char        TYPE_TOKEN_2    *dbcolsource(DBPROCESS *,int);
  2220. extern TYPE_TOKEN_1 void        TYPE_TOKEN_2    dbfreequal(char *);
  2221. extern TYPE_TOKEN_1 char        TYPE_TOKEN_2    *dbqual(DBPROCESS *,int,char *);
  2222. extern TYPE_TOKEN_1 DBINT       TYPE_TOKEN_2    dbspid(DBPROCESS *);
  2223. extern TYPE_TOKEN_1 char        TYPE_TOKEN_2    *dbtabname(DBPROCESS *,int);
  2224. extern TYPE_TOKEN_1 RETCODE     TYPE_TOKEN_2    dbtsput(DBPROCESS
  2225. *,DBBINARY *,int,int,char *);
  2226. extern TYPE_TOKEN_1 void        TYPE_TOKEN_2    dbclrbuf(DBPROCESS *,DBINT);
  2227. extern TYPE_TOKEN_1 RETCODE     TYPE_TOKEN_2    dbcmd(DBPROCESS *,char *);
  2228. extern TYPE_TOKEN_1 void        TYPE_TOKEN_2    dbfreebuf(DBPROCESS *);
  2229. extern TYPE_TOKEN_1 RETCODE     TYPE_TOKEN_2    dbfcmd(DBPROCESS
  2230. *,char *,...);
  2231. extern TYPE_TOKEN_1 int         TYPE_TOKEN_2    dbcolutype(DBPROCESS *,int);
  2232. extern TYPE_TOKEN_1 RETCODE TYPE_TOKEN_2  dbback_compatible(DBUSMALLINT,DBBOOL);
  2233. extern TYPE_TOKEN_1 DBBOOL      TYPE_TOKEN_2    db12hour(DBPROCESS
  2234. *,char *);
  2235. extern TYPE_TOKEN_1 BYTE        TYPE_TOKEN_2    *dbadata(DBPROCESS *,int,int);
  2236. extern TYPE_TOKEN_1 DBINT       TYPE_TOKEN_2    dbadlen(DBPROCESS *,int,int);
  2237. extern TYPE_TOKEN_1 int         TYPE_TOKEN_2    dbaltcolid(DBPROCESS *,int,int);
  2238. extern TYPE_TOKEN_1 DBINT       TYPE_TOKEN_2    dbaltlen(DBPROCESS *,int,int);
  2239. extern TYPE_TOKEN_1 int         TYPE_TOKEN_2    dbaltop(DBPROCESS *,int,int);
  2240. extern TYPE_TOKEN_1 int         TYPE_TOKEN_2    dbalttype(DBPROCESS *,int,int);
  2241. extern TYPE_TOKEN_1 BYTE        TYPE_TOKEN_2   *dbbylist(DBPROCESS *,int,int *);
  2242. extern TYPE_TOKEN_1 RETCODE     TYPE_TOKEN_2    dbcancel(DBPROCESS *);
  2243. extern TYPE_TOKEN_1 RETCODE     TYPE_TOKEN_2    dbregnowatch(DBPROCESS
  2244. *,DBCHAR *,DBSMALLINT);
  2245. extern TYPE_TOKEN_1 RETCODE     TYPE_TOKEN_2    dbcanquery(DBPROCESS *);
  2246. extern TYPE_TOKEN_1 DBINT       TYPE_TOKEN_2    dbreadpage(DBPROCESS
  2247. *,char*,DBINT,BYTE *);
  2248. extern TYPE_TOKEN_1 RETCODE     TYPE_TOKEN_2    dbwritepage(DBPROCESS
  2249. *,char*,DBINT,DBINT,BYTE *);
  2250. extern TYPE_TOKEN_1 char        TYPE_TOKEN_2    *dbchange(DBPROCESS *);
  2251. extern TYPE_TOKEN_1 DBPROCESS   TYPE_TOKEN_2    *dbopen(LOGINREC *,char *);
  2252. extern TYPE_TOKEN_1 void        TYPE_TOKEN_2    dbclose(DBPROCESS *);
  2253. extern TYPE_TOKEN_1 void        TYPE_TOKEN_2    dbexit(void);
  2254. extern TYPE_TOKEN_1 int         TYPE_TOKEN_2    dbgetlusername(LOGINREC
  2255. *,BYTE *,int);
  2256. extern TYPE_TOKEN_1 int         TYPE_TOKEN_2    dbgetmaxprocs(void);
  2257. extern TYPE_TOKEN_1 RETCODE     TYPE_TOKEN_2    dbsetmaxprocs(int);
  2258. extern TYPE_TOKEN_1 int         TYPE_TOKEN_2    dbdate4cmp(DBPROCESS
  2259. *,DBDATETIME4 *,DBDATETIME4 *);
  2260. extern TYPE_TOKEN_1 RETCODE     TYPE_TOKEN_2    dbdate4zero(DBPROCESS
  2261. *,DBDATETIME4 *);
  2262. extern TYPE_TOKEN_1 RETCODE     TYPE_TOKEN_2    dbdatechar(DBPROCESS
  2263. *,char *,int,int);
  2264. extern TYPE_TOKEN_1 int         TYPE_TOKEN_2    dbdatecmp(DBPROCESS
  2265. *,DBDATETIME *,DBDATETIME *);
  2266. extern TYPE_TOKEN_1 RETCODE     TYPE_TOKEN_2    dbdatecrack(DBPROCESS
  2267. *,DBDATEREC *,DBDATETIME *);
  2268. extern TYPE_TOKEN_1 RETCODE     TYPE_TOKEN_2    dbdatename(DBPROCESS
  2269. *,char *,int,DBDATETIME *);
  2270. extern TYPE_TOKEN_1 char        TYPE_TOKEN_2    *dbdateorder(DBPROCESS
  2271. *,char *);
  2272. extern TYPE_TOKEN_1 DBINT       TYPE_TOKEN_2    dbdatepart(DBPROCESS
  2273. *,int,DBDATETIME *);
  2274. extern TYPE_TOKEN_1 RETCODE     TYPE_TOKEN_2    dbdatezero(DBPROCESS
  2275. *,DBDATETIME *);
  2276. extern TYPE_TOKEN_1 char        TYPE_TOKEN_2    *dbdayname(DBPROCESS
  2277. *,char *,int);
  2278. extern TYPE_TOKEN_1 RETCODE     TYPE_TOKEN_2    dbnpcreate(DBPROCESS *);
  2279. extern TYPE_TOKEN_1 RETCODE     TYPE_TOKEN_2    dbnpdefine(DBPROCESS
  2280. *,DBCHAR *,DBSMALLINT);
  2281. extern TYPE_TOKEN_1 RETCODE     TYPE_TOKEN_2    dbregdrop(DBPROCESS
  2282. *,DBCHAR *,DBSMALLINT);
  2283. extern TYPE_TOKEN_1 RETCODE     TYPE_TOKEN_2    dbreginit(DBPROCESS
  2284. *,DBCHAR *,DBSMALLINT);
  2285. extern TYPE_TOKEN_1 RETCODE     TYPE_TOKEN_2    dbreglist(DBPROCESS *);
  2286. extern TYPE_TOKEN_1 RETCODE     TYPE_TOKEN_2    dbregparam(DBPROCESS
  2287. *,DBCHAR *,int,DBINT,DBVOIDPTR);
  2288. extern TYPE_TOKEN_1 RETCODE     TYPE_TOKEN_2    dbregexec(DBPROCESS
  2289. *,DBUSMALLINT);
  2290. extern TYPE_TOKEN_1 RETCODE     TYPE_TOKEN_2    dbfreesort(DBPROCESS
  2291. *,DBSORTORDER *);
  2292. extern TYPE_TOKEN_1 RETCODE     TYPE_TOKEN_2    dbfree_xlate(DBPROCESS
  2293. *,DBXLATE *,DBXLATE *);
  2294. extern TYPE_TOKEN_1 char        TYPE_TOKEN_2    *dbgetchar(DBPROCESS *,int);
  2295. extern TYPE_TOKEN_1 int         TYPE_TOKEN_2    dbgetoff(DBPROCESS
  2296. *,DBUSMALLINT,int);
  2297. extern TYPE_TOKEN_1 RETCODE     TYPE_TOKEN_2    dbreghandle(DBPROCESS
  2298. *, DBCHAR *,DBSMALLINT,INTFUNCPTR);
  2299. extern TYPE_TOKEN_1 RETCODE     TYPE_TOKEN_2    dbinit(void);
  2300. extern TYPE_TOKEN_1 DBSORTORDER TYPE_TOKEN_2    *dbloadsort(DBPROCESS
  2301. *);
  2302. extern TYPE_TOKEN_1 RETCODE     TYPE_TOKEN_2    dbload_xlate(DBPROCESS
  2303. *,char *,char *,DBXLATE **,DBXLATE **);
  2304. extern TYPE_TOKEN_1 LOGINREC    TYPE_TOKEN_2    *dblogin(void);
  2305. extern TYPE_TOKEN_1 void        TYPE_TOKEN_2    dbloginfree(LOGINREC *);
  2306. extern TYPE_TOKEN_1 RETCODE     TYPE_TOKEN_2    dbmnycopy(DBPROCESS
  2307. *,DBMONEY *, DBMONEY *);
  2308. extern TYPE_TOKEN_1 RETCODE     TYPE_TOKEN_2    dbmnyinit(DBPROCESS
  2309. *,DBMONEY *,int,DBBOOL *);
  2310. extern TYPE_TOKEN_1 RETCODE     TYPE_TOKEN_2    dbmnyndigit(DBPROCESS
  2311. *,DBMONEY *,DBCHAR *,DBBOOL *);
  2312. extern TYPE_TOKEN_1 RETCODE     TYPE_TOKEN_2    dbmnyinc(DBPROCESS
  2313. *,DBMONEY *);
  2314. extern TYPE_TOKEN_1 RETCODE     TYPE_TOKEN_2    dbmnydec(DBPROCESS
  2315. *,DBMONEY *);
  2316. extern TYPE_TOKEN_1 RETCODE     TYPE_TOKEN_2    dbmnyminus(DBPROCESS
  2317. *,DBMONEY *,DBMONEY *);
  2318. extern TYPE_TOKEN_1 RETCODE     TYPE_TOKEN_2    dbmnydown(DBPROCESS
  2319. *,DBMONEY *,int,int *);
  2320. extern TYPE_TOKEN_1 RETCODE     TYPE_TOKEN_2    dbmnyscale(DBPROCESS
  2321. *,DBMONEY *,int,int);
  2322. extern TYPE_TOKEN_1 RETCODE     TYPE_TOKEN_2    dbmnyadd(DBPROCESS
  2323. *,DBMONEY *,DBMONEY *,DBMONEY *);
  2324. extern TYPE_TOKEN_1 RETCODE     TYPE_TOKEN_2    dbmnysub(DBPROCESS
  2325. *,DBMONEY *,DBMONEY *,DBMONEY *);
  2326. extern TYPE_TOKEN_1 RETCODE     TYPE_TOKEN_2    dbmnydivide(DBPROCESS
  2327. *,DBMONEY *,DBMONEY *,DBMONEY *);
  2328. extern TYPE_TOKEN_1 RETCODE     TYPE_TOKEN_2    dbmnymul(DBPROCESS
  2329. *,DBMONEY *,DBMONEY *,DBMONEY *);
  2330. extern TYPE_TOKEN_1 RETCODE     TYPE_TOKEN_2    dbmnymaxpos(DBPROCESS
  2331. *,DBMONEY *);
  2332. extern TYPE_TOKEN_1 RETCODE     TYPE_TOKEN_2    dbmnymaxneg(DBPROCESS
  2333. *,DBMONEY *);
  2334. extern TYPE_TOKEN_1 int         TYPE_TOKEN_2    dbmnycmp(DBPROCESS
  2335. *,DBMONEY *,DBMONEY *);
  2336. extern TYPE_TOKEN_1 RETCODE     TYPE_TOKEN_2    dbmnyzero(DBPROCESS
  2337. *,DBMONEY *);
  2338. extern TYPE_TOKEN_1 RETCODE     TYPE_TOKEN_2    dbmny4copy(DBPROCESS
  2339. *,DBMONEY4 *,DBMONEY4 *);
  2340. extern TYPE_TOKEN_1 RETCODE     TYPE_TOKEN_2    dbmny4minus(DBPROCESS
  2341. *,DBMONEY4 *,DBMONEY4 *);
  2342. extern TYPE_TOKEN_1 RETCODE     TYPE_TOKEN_2    dbmny4add(DBPROCESS
  2343. *,DBMONEY4 *,DBMONEY4 *,DBMONEY4 *);
  2344. extern TYPE_TOKEN_1 RETCODE     TYPE_TOKEN_2    dbmny4sub(DBPROCESS
  2345. *,DBMONEY4 *,DBMONEY4 *,DBMONEY4 *);
  2346. extern TYPE_TOKEN_1 RETCODE     TYPE_TOKEN_2    dbmny4divide(DBPROCESS
  2347. *,DBMONEY4 *,DBMONEY4 *,DBMONEY4 *);
  2348. extern TYPE_TOKEN_1 RETCODE     TYPE_TOKEN_2    dbmny4mul(DBPROCESS
  2349. *,DBMONEY4 *,DBMONEY4 *,DBMONEY4 *);
  2350. extern TYPE_TOKEN_1 int         TYPE_TOKEN_2    dbmny4cmp(DBPROCESS
  2351. *,DBMONEY4 *,DBMONEY4 *);
  2352. extern TYPE_TOKEN_1 RETCODE     TYPE_TOKEN_2    dbmny4zero(DBPROCESS
  2353. *,DBMONEY4 *);
  2354. extern TYPE_TOKEN_1 char        TYPE_TOKEN_2    *dbmonthname(DBPROCESS
  2355. *,char *,int,DBBOOL);
  2356. extern TYPE_TOKEN_1 char        TYPE_TOKEN_2    *dbname(DBPROCESS *);
  2357. extern TYPE_TOKEN_1 RETCODE     TYPE_TOKEN_2    dbregwatchlist(DBPROCESS
  2358. *);
  2359. extern TYPE_TOKEN_1 RETCODE     TYPE_TOKEN_2    dbregwatch(DBPROCESS
  2360. *,DBCHAR *,DBSMALLINT,DBUSMALLINT);
  2361. extern TYPE_TOKEN_1 int         TYPE_TOKEN_2    dbnumalts(DBPROCESS *,int);
  2362. extern TYPE_TOKEN_1 int         TYPE_TOKEN_2    dbnumcompute(DBPROCESS *);
  2363. extern TYPE_TOKEN_1 int         TYPE_TOKEN_2    dbordercol(DBPROCESS *,int);
  2364. extern TYPE_TOKEN_1 RETCODE     TYPE_TOKEN_2    dbpoll(DBPROCESS
  2365. *,long,DBPROCESS **,int *);
  2366. extern TYPE_TOKEN_1 char        TYPE_TOKEN_2    *dbprtype(int);
  2367. extern TYPE_TOKEN_1 STATUS      TYPE_TOKEN_2    dbreadtext(DBPROCESS
  2368. *,void *,DBINT);
  2369. extern TYPE_TOKEN_1 RETCODE     TYPE_TOKEN_2    dbresults(DBPROCESS *);
  2370. extern TYPE_TOKEN_1 RETCODE     TYPE_TOKEN_2    dbsafestr(DBPROCESS
  2371. *,char *,DBINT,char *,DBINT,int);
  2372. extern TYPE_TOKEN_1 void        TYPE_TOKEN_2    dbsetavail(DBPROCESS *);
  2373. extern TYPE_TOKEN_1 void        TYPE_TOKEN_2
  2374. dbsetbusy(DBPROCESS *,void (*(*)())());
  2375. extern TYPE_TOKEN_1 void        TYPE_TOKEN_2    dbsetidle(DBPROCESS
  2376. *,void (*)());
  2377. extern TYPE_TOKEN_1 RETCODE     TYPE_TOKEN_2    dbsetlname(LOGINREC
  2378. *,char *,int);
  2379. extern TYPE_TOKEN_1 RETCODE     TYPE_TOKEN_2    dbsetlbool(LOGINREC
  2380. *,int,int);
  2381. extern TYPE_TOKEN_1 RETCODE     TYPE_TOKEN_2    dbsetlshort(LOGINREC
  2382. *,short,int);
  2383. extern TYPE_TOKEN_1 RETCODE     TYPE_TOKEN_2    dbsetllong(LOGINREC
  2384. *,long,int);
  2385. extern TYPE_TOKEN_1 void        TYPE_TOKEN_2    dbrpwclr(LOGINREC *);
  2386. extern TYPE_TOKEN_1 RETCODE     TYPE_TOKEN_2    dbrpwset(LOGINREC
  2387. *,char *,char *,int);
  2388. extern TYPE_TOKEN_1 RETCODE     TYPE_TOKEN_2    dbsettime(int);
  2389. extern TYPE_TOKEN_1 RETCODE     TYPE_TOKEN_2    dbsetlogintime(int);
  2390. extern TYPE_TOKEN_1 RETCODE     TYPE_TOKEN_2    dbsprhead(DBPROCESS
  2391. *,char *,DBINT);
  2392. extern TYPE_TOKEN_1 RETCODE     TYPE_TOKEN_2    dbsprline(DBPROCESS
  2393. *,char *,DBINT,DBCHAR);
  2394. extern TYPE_TOKEN_1 RETCODE     TYPE_TOKEN_2    dbspr1row(DBPROCESS
  2395. *,char *,DBINT);
  2396. extern TYPE_TOKEN_1 DBINT       TYPE_TOKEN_2    dbspr1rowlen(DBPROCESS
  2397. *);
  2398. extern TYPE_TOKEN_1 RETCODE     TYPE_TOKEN_2    dbsqlexec(DBPROCESS *);
  2399. extern TYPE_TOKEN_1 RETCODE     TYPE_TOKEN_2    dbsqlsend(DBPROCESS *);
  2400. extern TYPE_TOKEN_1 RETCODE     TYPE_TOKEN_2    dbsqlok(DBPROCESS *);
  2401. extern TYPE_TOKEN_1 int         TYPE_TOKEN_2    dbstrbuild(DBPROCESS
  2402. *, ...);
  2403. extern TYPE_TOKEN_1 int         TYPE_TOKEN_2    dbstrcmp(DBPROCESS
  2404. *,char *,int,char *,int,DBSORTORDER *);
  2405. extern TYPE_TOKEN_1 RETCODE     TYPE_TOKEN_2   dbstrcpy(DBPROCESS
  2406. *,int,int,char *);
  2407. extern TYPE_TOKEN_1 int         TYPE_TOKEN_2    dbstrlen(DBPROCESS *);
  2408. extern TYPE_TOKEN_1 int         TYPE_TOKEN_2    dbstrsort(DBPROCESS
  2409. *,char *,int,char *,int,DBSORTORDER *);
  2410. extern TYPE_TOKEN_1 int         TYPE_TOKEN_2    dbnumrets(DBPROCESS *);
  2411. extern TYPE_TOKEN_1 char        TYPE_TOKEN_2    *dbretname(DBPROCESS *,int);
  2412. extern TYPE_TOKEN_1 int         TYPE_TOKEN_2    dbrettype(DBPROCESS *,int);
  2413. extern TYPE_TOKEN_1 DBINT       TYPE_TOKEN_2    dbretlen(DBPROCESS *,int);
  2414. extern TYPE_TOKEN_1 BYTE        TYPE_TOKEN_2    *dbretdata(DBPROCESS *,int);
  2415. extern TYPE_TOKEN_1 RETCODE     TYPE_TOKEN_2    dbtraceon(DBPROCESS
  2416. *,DBUSMALLINT,FILE *,INTFUNCPTR);
  2417. extern TYPE_TOKEN_1 RETCODE     TYPE_TOKEN_2    dbtraceoff(DBPROCESS
  2418. *,DBUSMALLINT);
  2419. extern TYPE_TOKEN_1 DBINT       TYPE_TOKEN_2    dbtracestring(DBPROCESS
  2420. *,BYTE *,DBINT);
  2421. extern TYPE_TOKEN_1 RETCODE     TYPE_TOKEN_2    dbuse(DBPROCESS *,char *);
  2422. extern TYPE_TOKEN_1 void        TYPE_TOKEN_2  dbsetuserdata(DBPROCESS *,BYTE *);
  2423. extern TYPE_TOKEN_1 BYTE        TYPE_TOKEN_2    *dbgetuserdata(DBPROCESS *);
  2424. extern TYPE_TOKEN_1 RETCODE     TYPE_TOKEN_2    dbwritetext(DBPROCESS
  2425. *,char *, DBBINARY *, DBTINYINT, DBBINARY *, DBBOOL, DBINT, BYTE *);
  2426. extern TYPE_TOKEN_1 RETCODE     TYPE_TOKEN_2    dbmoretext(DBPROCESS 
  2427. *,DBINT,BYTE *);
  2428. extern TYPE_TOKEN_1 int         TYPE_TOKEN_2    dbxlate(DBPROCESS
  2429. *,char *,int,char *,int,DBXLATE *,int *,DBBOOL,int *);
  2430. extern TYPE_TOKEN_1 char        TYPE_TOKEN_2    *dbservcharset(DBPROCESS *);
  2431. extern TYPE_TOKEN_1 char        TYPE_TOKEN_2    *dbgetcharset(DBPROCESS *);
  2432. extern TYPE_TOKEN_1 char        TYPE_TOKEN_2    *dbgetnatlang(DBPROCESS *);
  2433. extern TYPE_TOKEN_1 int         TYPE_TOKEN_2    dbgetpacket(DBPROCESS *);
  2434. extern TYPE_TOKEN_1 STATUS      TYPE_TOKEN_2    dbgetrow(DBPROCESS *,DBINT);
  2435. extern TYPE_TOKEN_1 STATUS      TYPE_TOKEN_2    dbsetrow(DBPROCESS *,DBINT);
  2436. extern TYPE_TOKEN_1 char        TYPE_TOKEN_2    *dbcolname(DBPROCESS *,int);
  2437. extern TYPE_TOKEN_1 int         TYPE_TOKEN_2    dbcoltype(DBPROCESS *,int);
  2438. extern TYPE_TOKEN_1 DBINT       TYPE_TOKEN_2    dbcollen(DBPROCESS *,int);
  2439. extern TYPE_TOKEN_1 BYTE        TYPE_TOKEN_2    *dbdata(DBPROCESS *,int);
  2440. extern TYPE_TOKEN_1 DBINT       TYPE_TOKEN_2    dbdatlen(DBPROCESS *,int);
  2441. extern TYPE_TOKEN_1 int         TYPE_TOKEN_2    dbnumcols(DBPROCESS *);
  2442. extern TYPE_TOKEN_1 DBBOOL      TYPE_TOKEN_2    dbvarylen(DBPROCESS *,int);
  2443. extern TYPE_TOKEN_1 void                TYPE_TOKEN_2        dbrecftos(char *); /* RJD */
  2444. extern TYPE_TOKEN_1 void        TYPE_TOKEN_2    dbsetifile(char *);
  2445. extern TYPE_TOKEN_1 RETCODE     TYPE_TOKEN_2    dbgetloginfo(DBPROCESS
  2446. *,DBLOGINFO **);
  2447. extern TYPE_TOKEN_1 RETCODE     TYPE_TOKEN_2    dbsetloginfo(LOGINREC
  2448. *,DBLOGINFO *);
  2449. extern TYPE_TOKEN_1 STATUS      TYPE_TOKEN_2    dbnextrow(DBPROCESS *);
  2450. extern TYPE_TOKEN_1 DBBOOL      TYPE_TOKEN_2    dbisopt(DBPROCESS *,int,char *);
  2451. extern TYPE_TOKEN_1 RETCODE     TYPE_TOKEN_2   dbsetopt(DBPROCESS
  2452. *,int,char *,int);
  2453. extern TYPE_TOKEN_1 RETCODE     TYPE_TOKEN_2   dbclropt(DBPROCESS *,int,char *);
  2454. extern TYPE_TOKEN_1 RETCODE     TYPE_TOKEN_2    dbrecvpassthru(DBPROCESS
  2455. *,BYTE **);
  2456. extern TYPE_TOKEN_1 RETCODE     TYPE_TOKEN_2    dbsendpassthru(DBPROCESS
  2457. *,BYTE *);
  2458. extern TYPE_TOKEN_1 void        TYPE_TOKEN_2    dbprhead(DBPROCESS *);
  2459. extern TYPE_TOKEN_1 void        TYPE_TOKEN_2    dbfprhead(DBPROCESS
  2460. *,FILE *);
  2461. extern TYPE_TOKEN_1 RETCODE     TYPE_TOKEN_2    dbprrow(DBPROCESS *);
  2462. extern TYPE_TOKEN_1 RETCODE     TYPE_TOKEN_2    dbfprrow(DBPROCESS
  2463. *,FILE *);
  2464. extern TYPE_TOKEN_1 DBBOOL      TYPE_TOKEN_2    dbhasretstat(DBPROCESS *);
  2465. extern TYPE_TOKEN_1 DBINT       TYPE_TOKEN_2    dbretstatus(DBPROCESS *);
  2466. extern TYPE_TOKEN_1 RETCODE     TYPE_TOKEN_2    dbrpcinit(DBPROCESS
  2467. *,char *,DBSMALLINT);
  2468. extern TYPE_TOKEN_1 RETCODE     TYPE_TOKEN_2    dbrpcparam(DBPROCESS
  2469. *,char *,BYTE,int,DBINT,DBINT,BYTE *);
  2470. extern TYPE_TOKEN_1 RETCODE     TYPE_TOKEN_2    dbrpcsend(DBPROCESS *);
  2471. extern TYPE_TOKEN_1 void        TYPE_TOKEN_2    dbsetinterrupt(DBPROCESS
  2472. *,int (*)(),int (*)());        /* RJD */
  2473. extern TYPE_TOKEN_1 RETCODE TYPE_TOKEN_2  dbsetnull(DBPROCESS *,int,int,BYTE *);
  2474. extern TYPE_TOKEN_1 int         TYPE_TOKEN_2    (*dberrhandle(int (*)()))(); /* RJD */
  2475. extern TYPE_TOKEN_1 int         TYPE_TOKEN_2    (*dbmsghandle(int (*)()))(); /* RJD */
  2476. extern TYPE_TOKEN_1 DBBINARY    TYPE_TOKEN_2    *dbtxptr(DBPROCESS *,int);
  2477. extern TYPE_TOKEN_1 DBBINARY    TYPE_TOKEN_2    *dbtxtimestamp(DBPROCESS *,int);
  2478. extern TYPE_TOKEN_1 DBBINARY    TYPE_TOKEN_2    *dbtxtsnewval(DBPROCESS *);
  2479. extern TYPE_TOKEN_1 RETCODE TYPE_TOKEN_2  dbtxtsput(DBPROCESS
  2480. *,DBBINARY *,int);
  2481. extern TYPE_TOKEN_1 int         TYPE_TOKEN_2    dbbufsize(DBPROCESS *);
  2482.  
  2483. #if MAC
  2484. extern TYPE_TOKEN_1     DBINT   TYPE_TOKEN_2  dbtextsize(DBPROCESS
  2485. *);
  2486. #endif /* MAC */
  2487.  
  2488. /* Old API forward declarations */
  2489. extern TYPE_TOKEN_1 char        TYPE_TOKEN_2    *dbaltname(DBPROCESS
  2490. *,int,int);
  2491. extern TYPE_TOKEN_1 RETCODE     TYPE_TOKEN_2    dbsettimeout(DBPROCESS
  2492. *,int);
  2493. extern TYPE_TOKEN_1 char        TYPE_TOKEN_2    *dberrstr(int);
  2494. extern TYPE_TOKEN_1 char        TYPE_TOKEN_2    *dboserrstr(int);
  2495. extern TYPE_TOKEN_1 void        TYPE_TOKEN_2    dbperror(int);
  2496. extern TYPE_TOKEN_1 int         TYPE_TOKEN_2    dberrno(void);
  2497. extern TYPE_TOKEN_1 char        TYPE_TOKEN_2    *dbgetmsg(DBPROCESS
  2498. *);
  2499. extern TYPE_TOKEN_1 DBBOOL      TYPE_TOKEN_2    dbsetmsg(DBPROCESS
  2500. *,int);
  2501. extern TYPE_TOKEN_1 int         TYPE_TOKEN_2    dbnummsg(DBPROCESS *);
  2502. extern TYPE_TOKEN_1 char        TYPE_TOKEN_2    *dbservermsg(DBPROCESS
  2503. *,DBINT *,DBTINYINT *,DBINT *);
  2504. extern TYPE_TOKEN_1 char    TYPE_TOKEN_2    *dbversion(void);
  2505.  
  2506.  
  2507. /*
  2508. ** The following function is only accessable via the DBGETTIME macros.
  2509. */
  2510. extern TYPE_TOKEN_1 int        TYPE_TOKEN_2    db__getDbTimeout(DBPROCESS
  2511. *);
  2512.  
  2513. /* VMS programs can use the AST facility to write asynchronous DB-LIBRARY
  2514.  * programs.
  2515.  */
  2516.  
  2517. #if VMS
  2518. extern TYPE_TOKEN_1 RETCODE TYPE_TOKEN_2        dbcancel_a(DBPROCESS
  2519. *,RETCODE *,void (*)(),BYTE *);
  2520. extern TYPE_TOKEN_1 RETCODE TYPE_TOKEN_2        dbcanquery_a(DBPROCESS
  2521. *,RETCODE *,void (*)(),BYTE *);
  2522. extern TYPE_TOKEN_1 RETCODE TYPE_TOKEN_2        dbnextrow_a(DBPROCESS
  2523. *,RETCODE *,void (*)(),BYTE *);
  2524. extern TYPE_TOKEN_1 RETCODE TYPE_TOKEN_2        dbopen_a(LOGINREC
  2525. *,char *,DBPROCESS *,RETCODE *,void (*)(),BYTE *);
  2526. extern TYPE_TOKEN_1 RETCODE TYPE_TOKEN_2        dbresults_a(DBPROCESS
  2527. *,RETCODE *,void (*)(),BYTE *);
  2528. extern TYPE_TOKEN_1 RETCODE TYPE_TOKEN_2        dbsqlexec_a(DBPROCESS
  2529. *,RETCODE *,void (*)(),BYTE *);
  2530. extern TYPE_TOKEN_1 RETCODE TYPE_TOKEN_2        dbsqlok_a(DBPROCESS
  2531. *,RETCODE *,void (*)(),BYTE *);
  2532. extern TYPE_TOKEN_1 RETCODE TYPE_TOKEN_2    dbpoll_a(DBPROCESS
  2533. *, long, DBPROCESS **, int *, RETCODE *, void (*) (), BYTE *);
  2534. #endif /* VMS */
  2535.  
  2536. #else
  2537.  
  2538. /* bcp functions */
  2539. extern DBBOOL   bcp_getl();
  2540. extern BCPDESC  *bcpinit();
  2541. extern RETCODE  bcpcontrol();
  2542. extern RETCODE  bcpcolumn();
  2543. extern RETCODE  bcpformat();
  2544. extern RETCODE  bcpexec();
  2545. extern RETCODE  bcpbind();
  2546. extern RETCODE  bcpsendrow();
  2547. extern RETCODE  bcpabort();
  2548. extern RETCODE  bcpcollen();
  2549. extern DBINT    bcpdone();
  2550.  
  2551. /*
  2552. ** external declaration for functions referenced in this file as macros 
  2553. ** and were once macros
  2554. */
  2555. extern BYTE             bcp_hosttype();
  2556. extern int              dbtds();
  2557. extern int              dbcurcmd();
  2558. extern DBINT            dbcurrow();
  2559. extern DBINT            dbfirstrow();
  2560. extern DBINT            dblastrow();
  2561. extern DBINT            dbrowtype();
  2562. extern DBINT            dbmorecmds();
  2563. extern DBINT            donecontinue();
  2564. extern DBINT            dbcount();
  2565. extern DBINT            dbcmdrow();
  2566. extern DBINT            dbrows();
  2567. extern int              dbnumorders();
  2568. extern DBBOOL           dbbuffull();
  2569. extern DBBOOL           dbmorerows();
  2570. extern DBBOOL           dbisavail();
  2571. extern DBBOOL           dbdead();
  2572. extern int              dbiordesc();
  2573. extern int              dbiowdesc();
  2574. extern DBBOOL           dbrbuf();
  2575. extern short            dbgetlhier();
  2576. extern void             dbsetlrole();
  2577. extern int              dbsetlcomp();
  2578.  
  2579. /* Forward declarations of DB-LIBRARY routines */
  2580.  
  2581. extern DBINT            bcp_batch();
  2582. extern RETCODE          bcp_bind();
  2583. extern RETCODE          bcp_colfmt();
  2584. extern RETCODE          bcp_collen();
  2585. extern RETCODE          bcp_colptr();
  2586. extern RETCODE          bcp_columns();
  2587. extern RETCODE          bcp_control();
  2588. extern DBINT            bcp_done();
  2589. extern RETCODE          bcp_exec();
  2590. extern RETCODE          bcp_init();
  2591. extern RETCODE          bcp_moretext();
  2592. extern RETCODE        bcp_readfmt();
  2593. extern RETCODE          bcp_sendrow();
  2594. extern RETCODE        bcp_setxlate();
  2595. extern RETCODE        bcp_writefmt();
  2596.  
  2597. extern  DBPROCESS       *open_commit();
  2598. extern  void            close_commit();
  2599. extern  void            build_xact_string();
  2600. extern  DBINT           start_xact();
  2601. extern  RETCODE         commit_xact();
  2602. extern  RETCODE         abort_xact();
  2603. extern  RETCODE         remove_xact();
  2604. extern  RETCODE         scan_xact();
  2605. extern  int             stat_xact();
  2606.  
  2607. extern  int             dbaltutype();
  2608. extern  RETCODE         dbbind();
  2609. extern    DBINT        dbconvert();
  2610. extern    DBBOOL        dbwillconvert();
  2611. extern  RETCODE         dbnullbind();
  2612. extern  RETCODE         dbaltbind();
  2613. extern  RETCODE         dbanullbind();
  2614. extern  DBBOOL          dbcolbrowse();
  2615. extern  DBBOOL          dbtabbrowse();
  2616. extern  char            *dbtabsource();
  2617. extern  DBBINARY        *dbtsnewval();
  2618. extern  int             dbtsnewlen();
  2619. extern  int             dbtabcount();
  2620. extern  char            *dbcolsource();
  2621. extern  void            dbfreequal();
  2622. extern  char            *dbqual();
  2623. extern  DBINT           dbspid();
  2624. extern  char            *dbtabname();
  2625. extern  RETCODE         dbtsput();
  2626. extern  void            dbclrbuf();
  2627. extern  RETCODE         dbcmd();
  2628. extern  void            dbfreebuf();
  2629. extern  RETCODE         dbfcmd();
  2630. extern  int             dbcolutype();
  2631. extern  RETCODE         dbback_compatible();
  2632. extern  DBBOOL          db12hour();
  2633. extern  BYTE            *dbadata();
  2634. extern  DBINT           dbadlen();
  2635. extern  int             dbaltcolid();
  2636. extern  DBINT           dbaltlen();
  2637. extern  int             dbaltop();
  2638. extern  int             dbalttype();
  2639. extern  BYTE            *dbbylist();
  2640. extern  RETCODE         dbcancel();
  2641. extern  RETCODE         dbregnowatch();
  2642. extern  RETCODE         dbcanquery();
  2643. extern  DBINT           dbreadpage();
  2644. extern  RETCODE         dbwritepage();
  2645. extern  char            *dbchange();
  2646. extern  DBPROCESS       *dbopen();
  2647. extern  void            dbclose();
  2648. extern  void            dbexit();
  2649. extern  int             dbgetlusername();
  2650. extern  int             dbgetmaxprocs();
  2651. extern  RETCODE         dbsetmaxprocs();
  2652. extern  int             dbdate4cmp();
  2653. extern  RETCODE         dbdate4zero();
  2654. extern  RETCODE         dbdatechar();
  2655. extern  int             dbdatecmp();
  2656. extern  RETCODE         dbdatecrack();
  2657. extern  RETCODE         dbdatename();
  2658. extern  char            *dbdateorder();
  2659. extern  DBINT           dbdatepart();
  2660. extern  RETCODE         dbdatezero();
  2661. extern  char            *dbdayname();
  2662. extern  RETCODE         dbnpcreate();
  2663. extern  RETCODE         dbnpdefine();
  2664. extern  RETCODE         dbregdrop();
  2665. extern  RETCODE         dbreginit();
  2666. extern  RETCODE         dbreglist();
  2667. extern  RETCODE         dbregparam();
  2668. extern  RETCODE         dbregexec();
  2669. extern  RETCODE         dbfreesort();
  2670. extern  RETCODE         dbfree_xlate();
  2671. extern  char            *dbgetchar();
  2672. extern  int             dbgetoff();
  2673. extern  RETCODE         dbreghandle();
  2674. extern  RETCODE         dbinit();
  2675. extern  DBSORTORDER     *dbloadsort();
  2676. extern  RETCODE         dbload_xlate();
  2677. extern  LOGINREC        *dblogin();
  2678. extern  void            dbloginfree();
  2679. extern  RETCODE         dbmnycopy();
  2680. extern  RETCODE         dbmnyinit();
  2681. extern  RETCODE         dbmnyndigit();
  2682. extern  RETCODE         dbmnyinc();
  2683. extern  RETCODE         dbmnydec();
  2684. extern  RETCODE         dbmnyminus();
  2685. extern  RETCODE         dbmnydown();
  2686. extern  RETCODE         dbmnyscale();
  2687. extern  RETCODE         dbmnyadd();
  2688. extern  RETCODE         dbmnysub();
  2689. extern  RETCODE         dbmnydivide();
  2690. extern  RETCODE         dbmnymul();
  2691. extern  RETCODE         dbmnymaxpos();
  2692. extern  RETCODE         dbmnymaxneg();
  2693. extern  int             dbmnycmp();
  2694. extern  RETCODE         dbmnyzero();
  2695. extern  RETCODE         dbmny4copy();
  2696. extern  RETCODE         dbmny4minus();
  2697. extern  RETCODE         dbmny4add();
  2698. extern  RETCODE         dbmny4sub();
  2699. extern  RETCODE         dbmny4divide();
  2700. extern  RETCODE         dbmny4mul();
  2701. extern  int             dbmny4cmp();
  2702. extern  RETCODE         dbmny4zero();
  2703. extern  char            *dbmonthname();
  2704. extern  char            *dbname();
  2705. extern  RETCODE         dbregwatchlist();
  2706. extern  RETCODE         dbregwatch();
  2707. extern  int             dbnumalts();
  2708. extern  int             dbnumcompute();
  2709. extern  int             dbordercol();
  2710. extern  RETCODE         dbpoll();
  2711. extern  char            *dbprtype();
  2712. extern  STATUS          dbreadtext();
  2713. extern  RETCODE         dbresults();
  2714. extern  RETCODE         dbsafestr();
  2715. extern  void            dbsetavail();
  2716. extern  void            dbsetbusy();
  2717. extern  void            dbsetidle();
  2718. extern  RETCODE         dbsetlname();
  2719. extern  RETCODE         dbsetlbool();
  2720. extern  RETCODE         dbsetlshort();
  2721. extern  RETCODE         dbsetllong();
  2722. extern  void            dbrpwclr();
  2723. extern  RETCODE         dbrpwset();
  2724. extern  RETCODE         dbsettime();
  2725. extern  RETCODE         dbsetlogintime();
  2726. extern  RETCODE         dbsprhead();
  2727. extern  RETCODE         dbsprline();
  2728. extern  RETCODE         dbspr1row();
  2729. extern  DBINT           dbspr1rowlen();
  2730. extern  RETCODE         dbsqlexec();
  2731. extern  RETCODE         dbsqlsend();
  2732. extern  RETCODE         dbsqlok();
  2733. extern  int             dbstrbuild();
  2734. extern  int             dbstrcmp();
  2735. extern  RETCODE         dbstrcpy();
  2736. extern  int             dbstrlen();
  2737. extern  int             dbstrsort();
  2738. extern  int             dbnumrets();
  2739. extern  char            *dbretname();
  2740. extern  int             dbrettype();
  2741. extern  DBINT           dbretlen();
  2742. extern  BYTE            *dbretdata();
  2743. extern  RETCODE         dbtraceon();
  2744. extern  RETCODE         dbtraceoff();
  2745. extern  DBINT           dbtracestring();
  2746. extern  RETCODE         dbuse();
  2747. extern  void            dbsetuserdata();
  2748. extern  BYTE            *dbgetuserdata();
  2749. extern  RETCODE         dbwritetext();
  2750. extern  RETCODE         dbmoretext();
  2751. extern  int             dbxlate();
  2752. extern    char        *dbservcharset();
  2753. extern  char            *dbgetcharset();
  2754. extern  char            *dbgetnatlang();
  2755. extern  int             dbgetpacket();
  2756. extern  STATUS          dbgetrow();
  2757. extern  STATUS          dbsetrow();
  2758. extern  char            *dbcolname();
  2759. extern  int             dbcoltype();
  2760. extern  DBINT           dbcollen();
  2761. extern  BYTE            *dbdata();
  2762. extern  DBINT           dbdatlen();
  2763. extern  int             dbnumcols();
  2764. extern  DBBOOL          dbvarylen();
  2765. extern  void                        dbrecftos();
  2766. extern  void            dbsetifile();
  2767. extern  RETCODE         dbgetloginfo();
  2768. extern  RETCODE         dbsetloginfo();
  2769. extern  STATUS          dbnextrow();
  2770. extern  DBBOOL          dbisopt();
  2771. extern  RETCODE         dbsetopt();
  2772. extern  RETCODE         dbclropt();
  2773. extern  RETCODE         dbrecvpassthru();
  2774. extern  RETCODE         dbsendpassthru();
  2775. extern  void            dbprhead();
  2776. extern  void            dbfprhead();
  2777. extern  RETCODE         dbprrow();
  2778. extern  RETCODE         dbfprrow();
  2779. extern  DBBOOL          dbhasretstat();
  2780. extern  DBINT           dbretstatus();
  2781. extern  RETCODE         dbrpcinit();
  2782. extern  RETCODE         dbrpcparam();
  2783. extern  RETCODE         dbrpcsend();
  2784. extern  void            dbsetinterrupt();
  2785. extern  RETCODE         dbsetnull();
  2786. extern  int             (*dberrhandle())();
  2787. extern  int             (*dbmsghandle())();
  2788. extern  DBBINARY        *dbtxptr();
  2789. extern  DBBINARY        *dbtxtimestamp();
  2790. extern  DBBINARY        *dbtxtsnewval();
  2791. extern  RETCODE         dbtxtsput();
  2792. extern  int             dbbufsize();
  2793.  
  2794. #if MAC
  2795. extern  DBINT           dbtextsize();
  2796. #endif /* MAC */
  2797.  
  2798. /* Old API forward declarations */
  2799. extern  char            *dbaltname();
  2800. extern  RETCODE         dbsettimeout();
  2801. extern  char            *dberrstr();
  2802. extern  char            *dboserrstr();
  2803. extern  void            dbperror();
  2804. extern  int             dberrno();
  2805. extern  char            *dbgetmsg();
  2806. extern  DBBOOL          dbsetmsg();
  2807. extern  int             dbnummsg();
  2808. extern  char            *dbservermsg();
  2809. extern    char        *dbversion();
  2810.  
  2811.  
  2812. /*
  2813. ** The following function is only accessable via the DBGETTIME macros.
  2814. */
  2815. extern                  db__getDbTimeout();
  2816.  
  2817. /* VMS programs can use the AST facility to write asynchronous DB-LIBRARY
  2818.  * programs.
  2819.  */
  2820.  
  2821. #if VMS
  2822. extern RETCODE  dbcancel_a();
  2823. extern RETCODE  dbcanquery_a();
  2824. extern RETCODE  dbnextrow_a();
  2825. extern  RETCODE dbopen_a();
  2826. extern RETCODE  dbresults_a();
  2827. extern RETCODE  dbsqlexec_a();
  2828. extern RETCODE  dbsqlok_a();
  2829. extern RETCODE  dbpoll_a();
  2830. #endif /* VMS */
  2831.  
  2832. #endif /* COMPILE_STYLE */
  2833.  
  2834. #endif  /* __sybdb__ */
  2835.